Browse Source

Enable libffi package on win32,win64 and BSD targets, remove CPU restriction

git-svn-id: trunk@43975 -
pierre 5 years ago
parent
commit
367eac9743
3 changed files with 7 additions and 4 deletions
  1. 1 1
      packages/libffi/examples/simple.pp
  2. 1 2
      packages/libffi/fpmake.pp
  3. 5 1
      packages/libffi/src/ffi.pp

+ 1 - 1
packages/libffi/examples/simple.pp

@@ -3,7 +3,7 @@ program simple;
 uses
   ffi;
 
-function WritePChar(s: PChar): LongInt; cdecl;
+function WritePChar(s: PChar): LongInt;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
 begin
   Writeln(s);
   WritePChar := StrLen(s);

+ 1 - 2
packages/libffi/fpmake.pp

@@ -24,8 +24,7 @@ begin
     P.Email := '[email protected]';
     P.Description := 'Headers for the libFFI library (Foreign Function Interface)';
     P.NeedLibC:= true;  // true for headers that indirectly link to libc?
-    P.OSes := [linux];
-    P.CPUs := [x86_64];
+    P.OSes := [linux,win32,win64] + AllBSDOSes;
     P.Dependencies.Add('rtl-objpas');
 
     P.SourcePath.Add('src');

+ 5 - 1
packages/libffi/src/ffi.pp

@@ -184,7 +184,11 @@ const
   FFI_DEFAULT_ABI = ffi_abi(Ord(FFI_SYSV) {$ifdef FREEBSD}or FFI_SYSV_STRUCT_RET{$endif});
   {$endif}
 {$else}
+  {$ifdef WIN32}
+    FFI_DEFAULT_ABI = FFI_STDCALL;
+  {$else}
     FFI_DEFAULT_ABI = FFI_SYSV;
+  {$endif}
 {$endif}
 
 const
@@ -216,7 +220,7 @@ const
 {$endif}
 
 {$if defined(CPUARM)}
-  {$if definde(DARWIN)}
+  {$if defined(DARWIN)}
   FFI_TRAMPOLINE_SIZE = 12;
   FFI_TRAMPOLINE_CLOSURE_OFFSET = 8;
   {$elseif FFI_EXEC_TRAMPOLINE_TABLE}