[FFI] DNU ByteArray>>#rollAsDoubleToArity: arity

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

[FFI] DNU ByteArray>>#rollAsDoubleToArity: arity

Aliaksei Syrel
(In the latest FFI)

Assume we have a native call declaration (we want to get values from x and y later):

primGetCurrentPointX: x Y: y
 <primitive: #primitiveNativeCall module: #NativeBoostPlugin error: errorCode>

  ^self nbCall: #( void cairo_get_current_point (self, double * x, double * y))

Trying to use it as:

| x y |
x := (ByteArray new: 8).
y := (ByteArray new: 8).
self primGetCurrentPointX: x Y: y.
^ (x doubleAt: 1)@ (y doubleAt: 1) 

Throws DNU  ByteArray>>#rollAsDoubleToArity: arity .

However if primitive would be modified to:

^self nbCall: #( void cairo_get_current_point (self, void * x, void * y))

Exception goes away.

I'm just curios how it is supposed to be :)

Cheers,
Alex

Reply | Threaded
Open this post in threaded view
|

Re: [FFI] DNU ByteArray>>#rollAsDoubleToArity: arity

EstebanLM
Ah yes. I fixed that but is not in the image... Just load bleeding edge of UFFI

On 3 Mar 2016, at 18:30, Aliaksei Syrel <[hidden email]> wrote:

(In the latest FFI)

Assume we have a native call declaration (we want to get values from x and y later):

primGetCurrentPointX: x Y: y
 <primitive: #primitiveNativeCall module: #NativeBoostPlugin error: errorCode>

  ^self nbCall: #( void cairo_get_current_point (self, double * x, double * y))

Trying to use it as:

| x y |
x := (ByteArray new: 8).
y := (ByteArray new: 8).
self primGetCurrentPointX: x Y: y.
^ (x doubleAt: 1)@ (y doubleAt: 1) 

Throws DNU  ByteArray>>#rollAsDoubleToArity: arity .

However if primitive would be modified to:

^self nbCall: #( void cairo_get_current_point (self, void * x, void * y))

Exception goes away.

I'm just curios how it is supposed to be :)

Cheers,
Alex