--- a/ExternalLibraryFunction.st Wed Dec 02 21:30:55 2009 +0000
+++ b/ExternalLibraryFunction.st Fri Dec 04 20:30:11 2009 +0000
@@ -651,6 +651,9 @@
^ aType typeSymbol.
].
+ (aType endsWith:'*') ifTrue:[
+ ^ #pointer.
+ ].
(aType endsWith:'Pointer') ifTrue:[
^ #pointer.
].
@@ -708,7 +711,9 @@
invokeFFIwithArguments:argumentsOrNil forCPPInstance:aCPlusPlusObjectOrNil
|argTypeSymbols returnTypeSymbol failureCode failureInfo returnValue stClass vtOffset
- virtual async unlimitedStack callTypeNumber returnValueClass argValueClass|
+ virtual async unlimitedStack callTypeNumber returnValueClass argValueClass
+ oldReturnType oldArgumentTypes
+ |
argTypeSymbols := argumentTypes.
returnTypeSymbol := returnType.
@@ -782,6 +787,7 @@
ffi_abi __callType = FFI_DEFAULT_ABI;
VOIDFUNC codeAddress = (VOIDFUNC)__INST(code_);
int __numArgsWanted;
+
# define __FAIL__(fcode) \
{ \
failureCode = fcode; goto getOutOfHere; \
@@ -1373,6 +1379,16 @@
getOutOfHere: ;
%}.
failureCode notNil ifTrue:[
+ (failureCode == #UnknownReturnType
+ or:[ failureCode == #UnknownArgumentType ]) ifTrue:[
+ oldReturnType := returnType.
+ oldArgumentTypes := argumentTypes.
+ self adjustTypes.
+ ((oldReturnType ~= returnType) or:[oldArgumentTypes ~= argumentTypes]) ifTrue:[
+ thisContext restart
+ ].
+ ].
+
self primitiveFailed. "see failureCode and failureInfo for details"
^ nil
].
@@ -1423,11 +1439,11 @@
!ExternalLibraryFunction class methodsFor:'documentation'!
version
- ^ '$Id: ExternalLibraryFunction.st 10480 2009-12-02 21:30:55Z vranyj1 $'
+ ^ '$Id: ExternalLibraryFunction.st 10482 2009-12-04 20:30:11Z vranyj1 $'
!
version_CVS
- ^ '§Header: /cvs/stx/stx/libbasic/ExternalLibraryFunction.st,v 1.73 2009/11/05 22:33:27 cg Exp §'
+ ^ '§Header: /cvs/stx/stx/libbasic/ExternalLibraryFunction.st,v 1.74 2009/12/02 16:16:32 cg Exp §'
! !
ExternalLibraryFunction initialize!