[squeak-dev] Passing RawBitsArray subtypes to FFI?

MichaƂ Olszewski m.olszewski at nexat.pl
Tue Sep 7 06:58:13 UTC 2021


I'm currently working on bindings to vector graphics engine library and, 
to avoid creating redundant classes, I pass float arrays (Float64Array) 
to functions expecting a struct (the parameter is declared as 
void*/double*. Its not like C cares whether its an array of constant 
size or a struct).

However, I'm unable to do this because the call results in "could not 
coerce the arguments" error.

I performed a small test, by using #adoptInstance (damn, love how I can 
fiddle with guts of the system, so cool) on Float64Array object to turn 
it into ByteArray and... it actually works.

Am I doing something wrong or it's just that the FFI doesn't support 
passing RawBitsArray subclasses (besides ByteArray) yet?

PS. I'm using Squeak 6.0 20623

More information about the Squeak-dev mailing list