Browse Source

* Arrays used in CreateCIF must remain allocated while calling ffi_call.

Michaël Van Canneyt 4 weeks ago
parent
commit
12a43c0170
1 changed files with 2 additions and 1 deletions
  1. 2 1
      packages/libffi/src/ffi.manager.pp

+ 2 - 1
packages/libffi/src/ffi.manager.pp

@@ -657,10 +657,11 @@ begin
   end;
   CreateCIF(arginfos, argvalues, aCallConv, aResultType, aResultValue, aFlags, ffidata);
 
+  ffi_call(@ffidata.CIF, ffi_fn(aCodeAddress), ffidata.ResultValue, @ffidata.Values[0]);
+
   arginfos := Nil;
   argvalues := Nil;
 
-  ffi_call(@ffidata.CIF, ffi_fn(aCodeAddress), ffidata.ResultValue, @ffidata.Values[0]);
 
 {$ifdef USE_EXTENDED_AS_COMP_CURRENCY_RES}
   if Assigned(ffidata.ResultTypeData) then begin