Browse Source

# revisions: 43975,43998

git-svn-id: branches/fixes_3_2@47089 -
marco 4 years ago
parent
commit
1518284348
3 changed files with 17 additions and 4 deletions
  1. 1 1
      packages/libffi/examples/simple.pp
  2. 1 2
      packages/libffi/fpmake.pp
  3. 15 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

@@ -23,8 +23,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');

+ 15 - 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}
@@ -260,6 +264,16 @@ const
   FFI_TRAMPOLINE_SIZE = 12;
 {$elseif defined(CPUM68K)}
   FFI_TRAMPOLINE_SIZE = 16;
+{$elseif defined(CPURISCV32)}
+  FFI_TRAMPOLINE_SIZE = 24;
+{$elseif defined(CPURISCV64)}
+  FFI_TRAMPOLINE_SIZE = 24;
+{$elseif defined(CPUMIPS32)}
+  FFI_TRAMPOLINE_SIZE = 20;
+{$elseif defined(CPUMIPS64)}
+  FFI_TRAMPOLINE_SIZE = 56;
+#endif
+
 {$endif}
 
 {