[squeak-dev] Passing RawBitsArray subtypes to FFI?

Eliot Miranda eliot.miranda at gmail.com
Sat Sep 11 23:22:54 UTC 2021


Hi,

On Mon, Sep 6, 2021 at 11:58 PM MichaƂ Olszewski <m.olszewski at nexat.pl>
wrote:

> 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
>

see VMMaker.oscog-eem.3068/opensmalltalk-vm commit
ae0c1a6b473aa5ed05433d91a3257804aa1ddd90

Author: Eliot Miranda <eliot.miranda at gmail.com>
Date:   Sat Sep 11 16:19:04 2021 -0700

    CogVM source as per VMMaker.oscog-eem.3068

    ThreadedFFIPlugin:
    pass any kind of non-pointer object to non-byte */char * args.
    We could insist on void *, but let's see how we get on with this.

This should fix the issue.  So pick up a new VM from a Ci near you once the
crank has turned.

_,,,^..^,,,_
best, Eliot
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20210911/af31a916/attachment.html>


More information about the Squeak-dev mailing list