in reply to Calling C function from Raku

I bet on that Color argument. I don't think we support passing structs as value types. They will be passed as pointers instead which in turn will be interpreted as a color by that function (which causes the apparent randomness). Please try passing a manually packed uint32 instead: $r +< 24 +| $g +< 16 +| $b +< 8 +| $a (or maybe the other way round)

Replies are listed 'Best First'.
Re^2: Calling C function from Raku
by BenM (Initiate) on Mar 18, 2020 at 21:32 UTC
    Oh I should have thought of that. Structs being passed as a pointer makes complete sense. I gave it a go and packing a uint32 worked perfectly! Thank you very much for the help!