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

Mariano Martinez Peck marianopeck at gmail.com
Mon May 26 13:21:18 UTC 2008


sorry...now it goes in English...

I have a problem trying to invoke a function through FFI. I have bee using
FFI y some functions with no problem but now I have "could not coerce
arguments". This is the first time I have a void* parameter, so I believe
that could be the problem.

The function definition is:

int *odbx_set_option*(
    odbx_t* *handle*,
    unsigned int *option*,
    void* *value* )


Here is an example that shows how to use it in C:

option = ODBX_TLS_ALWAYS;
if( ( err = odbx_set_option( handle, ODBX_OPT_TLS, (void*) &option ) ) < 0 )
{
    fprintf( stderr, "odbx_set_option(): %s\n", odbx_error( handle, err ) );
    odbx_finish( handle );

    return err;
}


This is my method that map that function with FFI:

apiSetOption: handle option: anOption value: aValue
    "int odbx_unbind(odbx_t*)"
    <cdecl: long 'odbx_set_option' (ulong ulong void*) module: 'opendbx' >
    ^self externalCallFailed


I proobed void*, void, ulong y ulong* but I had that error in all cases.

Here is how my method is used:

err := OpenDBX apiSetOption: self option:32  value:1.

So, can someone help me?

thanks,

mariano
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20080526/e7c4eeb6/attachment.htm


More information about the Squeak-dev mailing list