External call failed
Bert Freudenberg
bert at impara.de
Sat Jun 25 13:22:32 UTC 2005
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 -
More information about the Squeak-dev
mailing list
|