best regards I would like to know if it is possible to use the wine libraries with freepascal compiler. kylix had a modified version of the wine libraries and I believe that it was possible to invoke them from pascal. I've tried several ways but all I get is "segment fault".
sorry for my English. Thanks.
program test01;
{$MODE Delphi} uses types;
Type BOOL = LongBool;
function GetCursorPos(var lpPoint: TPoint): BOOL; stdcall; external 'libuser32.so' name 'GetCursorPos';
var a:Tpoint;
begin
WriteLn('Calling wine function'); GetCursorPos(a); WriteLn('End Calling wine function'); WriteLn(a.x);
end.
program test02; {$Mode Delphi} uses sysutils,types;
Type BOOL = LongBool; TGetCursorPos=Function(var lpPoint: TPoint): BOOL;cdecl;
Function dlopen(name: pchar;mode: longint):pointer;cdecl;external 'dl'; Function dlsym(lib: pointer; name: pchar):pointer;cdecl;external 'dl'; Function dlclose(lib: pointer):longint;cdecl;external 'dl';
var lib : pointer; GetCursorPos:TGetCursorPos; a:Tpoint; begin
lib:=dlopen('/usr/lib/wine/user32.dll.so',1);
if lib <> nil then @GetCursorPos:=dlsym(lib,'GetCursorPos') else begin WriteLn('library not loaded'); exit; end;
if Assigned(GetCursorPos) then begin WriteLn('Calling GetCursorPos');
Try GetCursorPos(a); Except on E : Exception do WriteLn(E.Message); end; WriteLn('X:',a.x,' Y:',a.Y);
end else begin WriteLn('function not loaded'); exit; end;
dlclose(lib); end.