Thanks Igor,

I finally got it working. I am putting the code here so I can easily find it
next time I need to do this ;-)... and perhaps someone can point out a
better way to do it with ffi. 

BTW, NB looks very interesting, could it be possible to use it on 64bits? or
as someone said about ffi, it could require a major rewrite?

cheers!

incrementIntegerPointer: integerValue
        "FFITest incrementIntegerPointer: 3"

        | pointer integer data |
        (pointer := ExternalAddress allocate: ExternalType long byteSize)
signedLongAt: 1 put: integerValue.
        data := ExternalData fromHandle: pointer type: ExternalType long
asPointerType.
        self integerAsPointer: data.
        ^ pointer signedLongAt: 1


integerAsPointer: integer
        
        <cdecl: void  'IntegerAsPointer' (long *) module:'ffitest.so'>
        ^self externalCallFailed 




--
View this message in context: 
http://forum.world.st/FFI-basics-tp4531126p4649417.html
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.

Reply via email to