[FFI] DNU ByteArray>>#rollAsDoubleToArity: arity
(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
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 <alex.syrel@gmail.com> 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
participants (2)
-
Aliaksei Syrel -
Esteban Lorenzano