Yes, now it works! Thanks Igor. On Fri, Apr 20, 2012 at 4:46 PM, Igor Stasenko <siguctua@gmail.com> wrote:
On 20 April 2012 15:59, Jan van de Sandt <jvdsandt@gmail.com> wrote:
Hello,
I use NativeBoost to call some icu4c functions. This works fine most of the time. But now I run into the problem that when I pass nil as the argument value for one or more void* / char* parameters I get an error. When I pass a value or an empty ByteArray than it works.
According to the icu4c documentation I should be able to pass NULL as an argument value.
What am I missing?
For pointers, there is an options in callouts, #optCoerceNilToNull which should be set, then you can invoke the call with nil as argument, which will convert it to C NULL.
By default this option is OFF, because extra check means extra cycles.
You can control a callout options by either per function call (see NBBasicExamples>>readDoubleFrom:) or for all methods of your class as a whole, like:
MyClass class>>ffiCalloutOptions "by default, return all pointers as an instance of external address " ^ #( + optReturnPtrAsExternalAddress + optCoerceNilToNull "passing nil as pointer, will convert it to null(0) " )
Jan.
-- Best regards, Igor Stasenko.