On 28 September 2012 14:41, Federico.Balaguer <[email protected]> wrote: > 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?
for running NB FFI on 64 bits, first you need 64-bit VM. making NB work on 64-bits will require writing (but not rewriting) additional code, of course. > > 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. > -- Best regards, Igor Stasenko.
