[FFI] Passing a null in argument
Hi, I wanted to call a function using null as argument but did not managed to do so. I tried to use an integer, but the FFI forbids it. I tried to use FFIExternalObject null, but the FFI vould not coerce the arguments. To make it work I had to duplicate the method and set 0 instead of an argument. void foo (0); Is it possible to do it the first way ? Regards, Merwan
which function? declared how? used how? Esteban
On 23 Jun 2016, at 18:07, Merwan Ouddane <merwanouddane@gmail.com> wrote:
Hi,
I wanted to call a function using null as argument but did not managed to do so.
I tried to use an integer, but the FFI forbids it.
I tried to use FFIExternalObject null, but the FFI vould not coerce the arguments.
To make it work I had to duplicate the method and set 0 instead of an argument.
void foo (0);
Is it possible to do it the first way ?
Regards,
Merwan
On 23/06/2016 18:39, Esteban Lorenzano wrote:
which function? A function within a DLL file. declared how?
Something like: void foo( void *bar)
used how?
MyClass foo: bar ^ self ffiCall: #(void foo( void *bar)) MyClass foo: 0 MyClass foo: FFIExternalObject null
Esteban
On 23 Jun 2016, at 18:07, Merwan Ouddane <merwanouddane@gmail.com> wrote:
Hi,
I wanted to call a function using null as argument but did not managed to do so.
I tried to use an integer, but the FFI forbids it.
I tried to use FFIExternalObject null, but the FFI vould not coerce the arguments.
To make it work I had to duplicate the method and set 0 instead of an argument.
void foo (0);
Is it possible to do it the first way ?
Regards,
Merwan
On 23 Jun 2016, at 18:54, Merwan Ouddane <merwanouddane@gmail.com> wrote:
On 23/06/2016 18:39, Esteban Lorenzano wrote:
which function? A function within a DLL file. declared how?
Something like: void foo( void *bar)
used how?
MyClass foo: bar ^ self ffiCall: #(void foo( void *bar))
MyClass foo: 0 MyClass foo: FFIExternalObject null
is "ExternalAddress nullâ what you want.
Esteban
On 23 Jun 2016, at 18:07, Merwan Ouddane <merwanouddane@gmail.com> wrote:
Hi,
I wanted to call a function using null as argument but did not managed to do so.
I tried to use an integer, but the FFI forbids it.
I tried to use FFIExternalObject null, but the FFI vould not coerce the arguments.
To make it work I had to duplicate the method and set 0 instead of an argument.
void foo (0);
Is it possible to do it the first way ?
Regards,
Merwan
Yes it works, thank you Esteban On Thu, Jun 23, 2016 at 7:00 PM, Esteban Lorenzano <estebanlm@gmail.com> wrote:
On 23 Jun 2016, at 18:54, Merwan Ouddane <merwanouddane@gmail.com> wrote:
On 23/06/2016 18:39, Esteban Lorenzano wrote:
which function? A function within a DLL file. declared how?
Something like: void foo( void *bar)
used how?
MyClass foo: bar ^ self ffiCall: #(void foo( void *bar))
MyClass foo: 0 MyClass foo: FFIExternalObject null
is "ExternalAddress nullâ what you want.
Esteban
On 23 Jun 2016, at 18:07, Merwan Ouddane <merwanouddane@gmail.com>
wrote:
Hi,
I wanted to call a function using null as argument but did not managed
to do so.
I tried to use an integer, but the FFI forbids it.
I tried to use FFIExternalObject null, but the FFI vould not coerce
the arguments.
To make it work I had to duplicate the method and set 0 instead of an
argument.
void foo (0);
Is it possible to do it the first way ?
Regards,
Merwan
participants (2)
-
Esteban Lorenzano -
Merwan Ouddane