Igor we should collect all the emails of Jan and turn them into a section in the FFI chapter. Stef On Aug 24, 2012, at 5:36 PM, Igor Stasenko wrote:
On 24 August 2012 17:00, Jan van de Sandt <jvdsandt@gmail.com> wrote:
Hello,
NativeBoost doesn't allow me to pass a nil value instead of a String as a parameter for a 'const char*' function argument. When I use nil I get a failure with lastError=1
Is this by design? If so, is there an alternative?
yess..
by default if you use in signature a 'String' as argument type then the FFI routine will only accept an instances of variable-byte objects (which a ByteStrings are). But there is an option #optStringOrNull which will also allows passing a nil object as argument (which will be converted to NULL pointer value)
so, in your binding you must specify this option:
mymethod: string <...> ^ self nbCall: #( void whatever(String string)) options: #( optStringOrNull )
so, for passing null , you can simply pass a nil as argument:
self mymethod: nil.
Jan.
-- Best regards, Igor Stasenko.