On 27 September 2012 15:07, Federico.Balaguer <[email protected]> wrote: > I was looking for information in this area and this part of your hint : > > "So invoking this with say ExternalAddress allocate: **, gives us the > values as modified by the module.. and be converted as required into > ByteArray for the second" > > > makes me scratch my head for a while now :-). > > The part that I don't quite get is how should I use ExternalAddress (and > ExternalData). I have to make a call to a function that has a int* parameter > just allocate a buffer in external memory to big enough to hold the type value (4 bytes for int32) and pass it as argument to that function. then you should be able to read it back.
In NativeBoost you can do a following: intType := NBExternalTypeValue ofType: 'int'. "this will create an anonymous class for object, holding a value of type 'int' , so you actually don't need to do this all the time, just once in initialization of your class/package" intValue := intType new. "this will create a new instance" self foo: intValue (where #foo calls the function which expects int* argument) intValue value - to read the value. invValue value: 5 - to write the value. > Thanks! Federico > > > > -- > View this message in context: > http://forum.world.st/FFI-basics-tp4531126p4649258.html > Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com. > -- Best regards, Igor Stasenko.
