ExternalLibraryFunction.st
changeset 20288 604e46cfbf18
parent 19951 2ba5ef097a79
child 20289 5472006d6a61
--- a/ExternalLibraryFunction.st	Thu Aug 18 17:25:29 2016 +0200
+++ b/ExternalLibraryFunction.st	Thu Aug 18 18:20:52 2016 +0200
@@ -29,6 +29,7 @@
 #define VERBOSE
 
 #ifdef HAVE_FFI
+
 # include <ffi.h>
 # define MAX_ARGS    128
 
@@ -1784,16 +1785,20 @@
     failureInfo = nil;
 
     if (callTypeNumber == @global(CALLTYPE_API)) {
-#  ifdef CALLTYPE_FFI_STDCALL
+#  ifdef __MINGW64__
+	__callType = FFI_DEFAULT_ABI;
+#  else
+#   ifdef CALLTYPE_FFI_STDCALL
 	__callType = CALLTYPE_FFI_STDCALL;
-#   ifdef VERBOSE
+#    ifdef VERBOSE
 	if (@global(Verbose) == true) {
 	    printf("STDCALL\n");
 	}
-#   endif
-#  else
+#    endif
+#   else
 	failureCode = @symbol(FFICallTypeNotSupported);
 	goto getOutOfHere;
+#   endif
 #  endif
     }
 
@@ -1826,6 +1831,12 @@
     }
 
 # ifdef HAVE_FFI
+#  ifdef VERBOSE
+    if (@global(Verbose) == true) {
+	printf("prep: numargs=%d\n", __numArgsIncludingThis);
+    }
+#  endif
+
     if (ffi_prep_cif(&__cif, __callType, __numArgsIncludingThis, __returnType, __argTypesIncludingThis) != FFI_OK) {
 	__FAIL__(@symbol(FFIPrepareFailed))
     }