[squeak-dev] FFI problem: "could not coerce arguments"

Bert Freudenberg bert at freudenbergs.de
Mon May 26 13:36:08 UTC 2008


On 26.05.2008, at 15:21, Mariano Martinez Peck wrote:

> "could not coerce arguments"
> int odbx_set_option(
>     odbx_t* handle,
>     unsigned int option,
>     void* value )
> apiSetOption: handle option: anOption value: aValue
>     "int odbx_unbind(odbx_t*)"
>     <cdecl: long 'odbx_set_option' (ulong ulong void*) module:  
> 'opendbx' >
>     ^self externalCallFailed
>
> err := OpenDBX apiSetOption: self option:32  value:1.


The first argument appears to be a pointer to a handle object. You  
probably should not declare that as ulong if you then pass  
"self" (which I assume is a ExternalStructure subclass). But that  
depends on how you acquire the handle, and how you represent it in the  
image.

The argument to void* should be a ByteArray or WordArray, methinks,  
I'd try "WordArray with: 1" if you want to pass a pointer to the  
Integer 1.

- Bert -





More information about the Squeak-dev mailing list