--- a/ExternalLibraryFunction.st Sat Jun 04 03:31:52 2016 +0200
+++ b/ExternalLibraryFunction.st Sat Jun 04 04:06:22 2016 +0200
@@ -1068,7 +1068,7 @@
int __returnType = 0;
int thisType;
int __callType = FFI_DEFAULT_ABI;
-
+ int __anyFloatOrDoubleArg = 0;
#endif
union u {
@@ -1528,7 +1528,6 @@
__FAIL__(@symbol(InvalidArgument))
}
argValuePtr = &(__argValues[i].fVal);
-
} else if (typeSymbol == @symbol(double)) {
thisType = TYPE_DOUBLE;
if (__isSmallInteger(arg)) {
@@ -1767,6 +1766,9 @@
__argTypes[i] = thisType;
__argValuePointers[i] = argValuePtr;
+ if ((thisType == TYPE_FLOAT) || (thisType == TYPE_DOUBLE)) {
+ __anyFloatOrDoubleArg = 1;
+ }
# ifdef VERBOSE
if (@global(Verbose) == true) {
printf("arg%d: %"_lx_" type:%"_lx_"\n", i+1, (INT)(__argValues[i].iVal), (INT)thisType);
@@ -1861,6 +1863,18 @@
// and the return types float and double are handled diferently from ints.
// If that is not correct for your CPU/architecture, an ifndef is required here.
+# if defined(__x86_64__)
+ if (__anyFloatOrDoubleArg) {
+# ifdef VERBOSE
+ if (@global(Verbose) == true) {
+ printf("float/double args currently not supported\n");
+ }
+# endif
+ failureCode = @symbol(FFIDoubleArgNotSupported);
+ goto getOutOfHere;
+ }
+# endif
+
# if !defined(SomeArchitechtureForWhichAboveIsNotTrue)
{
VOIDPTRFUNC fi = (VOIDPTRFUNC)codeAddress;
@@ -1949,7 +1963,7 @@
__argValues[12].pointerVal, __argValues[13].pointerVal, __argValues[14].pointerVal );
break;
default:
- failureCode = @symbol(FFINotSupported);
+ failureCode = @symbol(TooManyArguments);
goto getOutOfHere;
}
break;
@@ -2035,7 +2049,7 @@
__argValues[12].pointerVal, __argValues[13].pointerVal, __argValues[14].pointerVal );
break;
default:
- failureCode = @symbol(FFINotSupported);
+ failureCode = @symbol(TooManyArguments);
goto getOutOfHere;
}
}