it doesn’t really matters. 
what you need to be sure for alien is that you have an “evaluator” for that 
callback. 

for example, the 

exampleCqsort

uses this callback: 

int (*)(const void *, const void *)

so, in “Callback” instance side, you can find this definition: 

voidstarvoidstarRetint: callbackContext sp: spAlien
        <signature: 'int (*)(const void *, const void *)' abi: 'IA32'>
        ^callbackContext wordResult:
                (block
                        value: (Alien forPointer: (spAlien unsignedLongAt: 1))
                        value: (Alien forPointer: (spAlien unsignedLongAt: 5)))

So, you need to add a method extension, something like: 

ulongulongRetulong: callbackContext sp: spAlien
        <signature: ‘ulong (*)(ulong, ulong)' abi: 'IA32'>
        ^callbackContext wordResult:
                (block
                        value: (spAlien unsignedLongAt: 1)
                        value: (spAlien unsignedLongAt: 5))

then you can declare your callback something like: 

        cb := Callback
                signature: 'ulong (*)(ulong, ulong)'
                block: [ :arg1 :arg2 | ... ].

that has to work :)

yes, is pretty complicated, and yes, you need to do a method for each kind of 
different signature you want to use. 
but well, is the way it works now :)

Esteban 


On 09 Sep 2014, at 12:00, Annick Fron <l...@afceurope.com> wrote:

> What signature should I use for a callback ? 
> ‘ulong’ does not seem to work
> 
> Annick


Reply via email to