FFI callbacks

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

FFI callbacks

Annick
In order to use the callbacks, I need to write a pragma in the Callback class for the signature.

My signature is something like (where ulong means pointer)

void (ulong ulong long long ulong)

Can you help me ?

Here is an example for another signature :

!Callback methodsFor: 'signatures' stamp: 'eem 11/1/2010 16:40'!
intcharstarRetint: callbackContext sp: spAlien
        <signature: 'int (*)(int, char *)' abi: 'IA32'>
        ^callbackContext wordResult:
                ((block
                        value: (spAlien signedLongAt: 1) ~= 0
                        value: (Alien forPointer: (spAlien unsignedLongAt: 5)) strcpyUTF8)
                                ifNil: [0]
                                ifNotNil:
                                        [:result|
                                        result isInteger
                                                ifTrue: [result]
                                                ifFalse: [result == true ifTrue: [1] ifFalse: [0]]])! !