easyreportinua / delphichromiumembedded

Automatically exported from code.google.com/p/delphichromiumembedded
0 stars 0 forks source link

API Translation Error in FPC2.4.0 #21

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1.in FPC2.4.0 + Lazarus 0.9.29 
  (Donwload http://www.hu.freepascal.org/lazarus/)
2.Convert \demos\cefclient\cefclient.dpr to cefclient.lpr
3.Build and Run 

What is the expected output? What do you see instead?
Application crash

What version of the product are you using? On what operating system?

XP SP3 + FPC2.4.0 + Lazarus 0.9.29 
dcef-r181

Please provide any additional information below.
...
---------------------------------------------------------------

cef_capi.h 

CEF_EXPORT int cef_browser_create(cef_window_info_t* windowInfo, int popup,
    struct _cef_handler_t* handler, const cef_string_t* url);

CEF_EXPORT int cef_register_scheme(const cef_string_t* scheme_name,
    const cef_string_t* host_name,
    struct _cef_scheme_handler_factory_t* factory);

ceflib.pas
// this work in delphi ok 
// in FPC Error
cef_browser_create: function(windowInfo: PCefWindowInfo; popup: Integer; 
handler: PCefHandler; const url: TCefString): Integer; cdecl;

cef_register_scheme: function(const scheme_name, host_name: TCefString; 
factory: PCefSchemeHandlerFactory): Integer; cdecl;

// this delphi and FPC all OK
cef_browser_create: function(windowInfo: PCefWindowInfo; popup: Integer; 
handler: PCefHandler; const url: PCefString): Integer; cdecl;

cef_register_scheme: function(const scheme_name, host_name: PCefString; 
factory: PCefSchemeHandlerFactory): Integer; cdecl;

const cef_string_t* url --->>> const url: PCefString

---------------------------------------------------------------

There are many similar mistakes

my First Fixed(in delphi2010,fpc2.4.0+Lazarus0.9.29 TestOK):

ceflib.pas

function CefBrowserCreate(windowInfo: PCefWindowInfo; popup: Boolean;
  handler: PCefHandler; const url: ustring): Boolean;
var CefS: TCefString;
begin
  CefLoadLibDefault;
  CefS := CefString(url);
  Result := cef_browser_create(
      windowInfo,
      Ord(popup),
      handler,
      @CefS) <> 0;
end;

function CefRegisterScheme(const SchemeName, HostName: ustring;
  const handler: TCefSchemeHandlerClass): Boolean;
var CefS_SchemeName, CefS_HostName: TCefString;
begin
  CefLoadLibDefault;
  CefS_SchemeName := CefString(SchemeName);
  Result := cef_register_scheme(
    @CefS_SchemeName,
    @CefS_HostName,
    (TCefSchemeHandlerFactoryOwn.Create(handler) as ICefBase).Wrap) <> 0;
end;

Original issue reported on code.google.com by xbp...@gmail.com on 11 Feb 2011 at 8:21

Attachments:

GoogleCodeExporter commented 8 years ago
fixed "const cef_string_t* url --->>> const url: PCefString"
in Attach fpc_dcef-r181.zip

FPC2.4.0 + Lazarus 0.9.29

1.  copy dcef-r181\bin\*.* fpc_dcef-r181\bin\*.*

2.  Lazarus open
fpc_dcef-r181\demos\lpf_cefclient\cefclient.lpr

3.  build and run

Original comment by xbp...@gmail.com on 11 Feb 2011 at 10:57

Attachments:

GoogleCodeExporter commented 8 years ago

Original comment by hgourv...@gmail.com on 23 Feb 2011 at 1:54