Skip to content

Instantly share code, notes, and snippets.

@retupmoca
Created April 25, 2014 13:55
Show Gist options
  • Save retupmoca/11290398 to your computer and use it in GitHub Desktop.
Save retupmoca/11290398 to your computer and use it in GitHub Desktop.
moar CStruct repr precomp bug
use v6;
use NativeCall;
class foo is repr('CStruct'); # works fine without the repr('CStruct')
has CArray $!foo;
method set-foo(CArray $arr) {
$!foo := $arr;
}
> perl6 -I. user.pl
alive
> perl6 --target=mbc --output=foo.moarvm foo.pm6
> perl6 -I. user.pl
Can not bind non-existent attribute '$!foo'
in method set-foo at foo.pm6:8
in block at user.pl:6
>
use foo;
use NativeCall;
my $arr = CArray[int8].new;
$arr[0] = 42;
foo.new.set-foo($arr);
say 'alive';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment