[squeak-dev] Passing RawBitsArray subtypes to FFI?

Michał Olszewski m.olszewski at nexat.pl
Tue Sep 7 10:24:16 UTC 2021


Hi,

No problem! Should've expected that, given I'm using alpha version.

I have one extra question (forgot to include it).

I noticed that, when I pin some object (in my case it's Form's bits) 
that I'm about to pass to FFI call, the call fails with "could not...". 
However, the call succeeds when called again with the same object.

When I don't pin it, the call succeeds the first time.

Could you explain it?


W dniu 2021-09-07 o 11:30, Marcel Taeumel pisze:
> Hi, there.
>
> > However, I'm unable to do this because the call results in "could not
> > coerce the arguments" error.
>
> https://github.com/OpenSmalltalk/opensmalltalk-vm/issues/569
>
> We are on it. Sorry for the inconvenience.
>
> Best,
> Marcel
>>
>> Am 07.09.2021 08:58:36 schrieb Michał Olszewski <m.olszewski at nexat.pl>:
>>
>> Hello,
>>
>> 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
>>
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20210907/f14bb703/attachment.html>


More information about the Squeak-dev mailing list