Hi Esteban,
Previously, I was doing with NB something like this: pointer := NativeBoost allocate: 4. self primitiveWhatever: pointer and: primitiveWhatever: pointer <primitive: #primitiveNativeCall module: #NativeBoostPlugin error: errorCode > ^ self nbCall: #( int void (NBExternalAddress pointer ) ) But of course that doesn't work with latest FFI. So I tried instead: pointer := ExternalAddress allocate: 4. primitiveWhatever: pointer <primitive: #primitiveNativeCall module: #NativeBoostPlugin error: errorCode > ^ self nbCall: #( int void (ExternalAddress pointer ) ) But then I get a ExternalAddress class #asExternalTypeOn: which is sent in FFICallout >> resolveType: Any idea how can I use ExternalAddress in the signature of the FFI primitive call? What am I doing wrong? Thanks in advance, |
On Mon, Dec 28, 2015 at 5:11 PM, Mariano Martinez Peck <[hidden email]> wrote:
It looks like if I set "void*" rather than ExternalAddress it does work. Is this the expected path?
|
so.. ExternalAddress *should* map to void* by it self. If it does not, there is a bug (please report :P) but yes, using void* as argument should work out of the box so should not get the error below (none of my tests caused that either, so I do not understand why it can happen… I guess something in your code I do not completely understand). in general, I recommend to use the C type (void*) instead the pharo type (ExternalAddress)… the whole idea below NB was to provide an interfase where you can just copy and paste the C definition from a header file… even if that’s not the case all the time. Esteban
|
Free forum by Nabble | Edit this page |