<div dir="ltr"><pre>Igor: I tried what you said but I get the same error. Here is more information:<br><br>The C function is like this:<br> <br>int <b>odbx_result</b>(<br> odbx_t* <i><b>handle</b></i>,<br> odbx_result_t** <i><b>result</b></i>,<br>
struct timeval* <i><b>timeout</b></i>,<br> unsigned long <i><b>chunk</b></i> )<br></pre><br>My method with FFI is this:<br><br>apiQueryResult: connectionHandle handle: handle timeout: timeout chunk: chunk<br> <cdecl: long 'odbx_result' (ulong ulong* DBXTimeSpec ulong) module: 'opendbx'><br>
^self externalCallFailed<br><br>And DBXTimeSpec has 2 attributes (seconds y nseconds). It has this class message:<br><br>DBXTimeSpec<br>fields<br> ^#(<br> (seconds 'long')<br> (nseconds 'long'))<br>
<br><br>Many thanks,<br><br>Mariano<br><br><br><br><div class="gmail_quote">On Wed, Sep 17, 2008 at 2:02 AM, Igor Stasenko <span dir="ltr"><<a href="mailto:siguctua@gmail.com">siguctua@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">2008/9/17 Mariano Martinez Peck <<a href="mailto:marianopeck@gmail.com">marianopeck@gmail.com</a>>:<br>
<div><div></div><div class="Wj3C7c">> Hi everybody!<br>
><br>
> I need to call a C function with a NULL value in one of the parameter. I<br>
> tried to send it a nil but I got an error in FFI when trying to call that<br>
> function. The error is: "cannot coerce arguments". Obviously this error says<br>
> FFI cannot map from nil to null.<br>
><br>
> Do someone know how can I do this?<br>
><br>
</div></div>you mean C's NULL?<br>
AFAIK it defined as<br>
#define NULL 0<br>
<br>
so, in squeak you can simply pass 0.<br>
<br>
> many thanks,<br>
><br>
> mariano<br>
><br>
><br>
><br>
><br>
<font color="#888888"><br>
<br>
<br>
--<br>
Best regards,<br>
Igor Stasenko AKA sig.<br>
<br>
</font></blockquote></div><br></div>