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)
In Section
Seekers of Perl Wisdom