FFI problem: too many arguments
Andreas Raab
andreas.raab at gmx.de
Thu Feb 16 22:30:49 UTC 2006
nicolas cellier wrote:
> Maybe a trick is possible at FFI level ? (pass an array of arguments)
That is indeed possible. For example:
MyClass>>initialize
"Set up an ffi call"
MyFFICall := ExternalLibraryFunction
name: 'myfunction'
module: 'mymodule'
callType: FFICallTypeCDecl
returnType: ExternalType char
argumentTypes: {
ExternalType ulong.
ExternalType ulong.
ExternalType ulong
"..."
}
This is exactly equivalent to, e.g.,
myFunction: arg1 with: arg2 with: arg3
<cdecl: char 'myfunction' (ulong ulong ulong) module: 'mymodule'>
and can later be invoked via:
MyFFICall invokeWithArguments: #(1 2 3).
Cheers,
- Andreas
More information about the Squeak-dev
mailing list
|