Hello,
I have a function fnTest which is written in a MS Windows DLL. It works fine when I call it from another exe. When I call it from my subclass of Object in the following method I get externalCallFailed error. --------------------------------------------------------------------- go "Call fnTest from PangoDll"
<apicall: void 'fnTest' (void) module:'pangodll.dll'> ^super externalCallFailed --------------------------------------------------------------------- How do I figure out what the problem is. The call stack is given at the end of this mail.
Thank You, Himanshu.
P.S. Call stack when go is called:-
Error: Unable to find function address 25 August 2005 1:21:40 pm
VM: Win32 - a SmalltalkImage Image: Squeak3.7 [latest update: #5989]
SecurityManager state: Restricted: false FileAccess: true SocketAccess: true Working Dir D:\squeak Trusted Dir D:\squeak\printer Untrusted Dir C:\My Squeak\printer
ExternalFunction class(Object)>>error: Receiver: ExternalFunction Arguments and temporary variables: aString: 'Unable to find function address' Receiver's instance variables: superclass: ExternalObject methodDict: a MethodDictionary(#argTypes->a CompiledMethod (1544) #callingConve...etc... format: 136 instanceVariables: #('flags' 'argTypes') organization: ('initialize-release' initialize) ('accessing' argTypes flags mod...etc... subclasses: #(ExternalLibraryFunction) name: #ExternalFunction classPool: a Dictionary(#FFIErrorMessages->a Dictionary(-1->'Callout mechanism ...etc... sharedPools: an OrderedCollection(FFIConstants) environment: a SystemDictionary(lots of globals) category: nil
ExternalFunction class>>externalCallFailed Receiver: ExternalFunction Arguments and temporary variables: errCode: 13 Receiver's instance variables: superclass: ExternalObject methodDict: a MethodDictionary(#argTypes->a CompiledMethod (1544) #callingConve...etc... format: 136 instanceVariables: #('flags' 'argTypes') organization: ('initialize-release' initialize) ('accessing' argTypes flags mod...etc... subclasses: #(ExternalLibraryFunction) name: #ExternalFunction classPool: a Dictionary(#FFIErrorMessages->a Dictionary(-1->'Callout mechanism ...etc... sharedPools: an OrderedCollection(FFIConstants) environment: a SystemDictionary(lots of globals) category: nil
Pango(Object)>>externalCallFailed Receiver: a Pango Arguments and temporary variables:
Receiver's instance variables: a Pango Pango>>go Receiver: a Pango Arguments and temporary variables:
Receiver's instance variables: a Pango
Am 25.06.2005 um 12:50 schrieb Himanshu Garg:
Hello,
I have a function fnTest which is written in a MS Windows DLL. It
works fine when I call it from another exe. When I call it from my subclass of Object in the following method I get externalCallFailed error.
go "Call fnTest from PangoDll"
<apicall: void 'fnTest' (void) module:'pangodll.dll'> ^super externalCallFailed
Make sure there is no name mangling going on. 'fnTest' has to be the *exact* name found in the library file. If, for example, the library actually contains the symbol '_fnTest' then you'ld have to use that.
If you use C++, make sure to put the function in your headers inside 'extern "C" {...}'. Here is a mini-howto on that (Squeak FFI uses the dlopen/dlsym scheme described there, but from C, not from C++):
http://www.linuxdownloads.org/minihowto/C++-dlopen.html
Also, it could be that a header file redefines the function name so that it appears differently in the library than in the source code (this happens a lot with Windows functions on strings, which generally have an A or W appended by some macro magic).
- Bert -
squeak-dev@lists.squeakfoundation.org