ExternalLibraryFunction.st
changeset 9337 ab6bbf58bf0a
parent 9336 f604a89f17f5
child 9339 a833dc3f5702
--- a/ExternalLibraryFunction.st	Wed Apr 26 13:20:43 2006 +0200
+++ b/ExternalLibraryFunction.st	Wed Apr 26 13:26:47 2006 +0200
@@ -21,9 +21,20 @@
 
 !ExternalLibraryFunction primitiveDefinitions!
 %{
-# include <ffi.h>
 
+/*
+ * does this architecture support FFI ?
+ * NOTICE: this is going to be moved to an architecture-specific xxxIntern.h file.
+ */
+#ifdef WIN32
+# define HAVE_FFI
+#endif
+
+
+#ifdef HAVE_FFI
+# include <ffi.h>
 # define MAX_ARGS    128
+#endif
 
 %}
 ! !
@@ -175,6 +186,7 @@
     returnTypeSymbol := self ffiTypeSymbolForType:returnType.
 
 %{  /* UNLIMITEDSTACK */
+#ifdef HAVE_FFI
     ffi_cif __cif;
     ffi_type *__argTypes[MAX_ARGS];
     ffi_type *__returnType = NULL;
@@ -435,8 +447,11 @@
 	RETURN ( nil );
     }
     failureCode = @symbol(UnknownReturnType);
+error: ;
 
-error: ;
+#else /* no FFI support */
+    failureCode = @symbol(FFINotSupported);
+#endif /* HAVE_FFI */
 %}.
     failureCode notNil ifTrue:[
 	self primitiveFailed
@@ -496,5 +511,5 @@
 !ExternalLibraryFunction class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/ExternalLibraryFunction.st,v 1.13 2006-04-26 11:20:43 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/ExternalLibraryFunction.st,v 1.14 2006-04-26 11:26:47 cg Exp $'
 ! !