Hi, I am having trouble passing nil to a function with FFI (i.e. NULL, i.e. 0). For example: SDL2 glCreateContext: nil. The function expects a subclass of FFIExternalObject, so calls instVarAt: 1 but nil has no such field! Am I missing something? (like a special nil instance of FFIExternalObject) Note however that putting nil works when FFI expects a String. Cheers, Thibault Raffaillac
Hi, marshalling in UFFI is complex and sometimes not worthy, so we do not do auto-conversion between nil in smalltalk o zero to NULL (yes, I know NULL=0, but not for UFFI who is waiting a object type). In this case (since it expects a kind of external object) you have to do: SDL2 glCreateContext: FFIExternalObject null. Esteban
On 07 Apr 2016, at 12:06, Thibault Raffaillac <thibault.raffaillac@inria.fr> wrote:
Hi,
I am having trouble passing nil to a function with FFI (i.e. NULL, i.e. 0). For example: SDL2 glCreateContext: nil. The function expects a subclass of FFIExternalObject, so calls instVarAt: 1 but nil has no such field! Am I missing something? (like a special nil instance of FFIExternalObject) Note however that putting nil works when FFI expects a String.
Cheers, Thibault Raffaillac
participants (2)
-
Esteban Lorenzano -
Thibault Raffaillac