cglobal() behaves differently when used with a "my" or "our" variable

37 Views Asked by At

I found out something I cannot explain, so I golfed it to what I think is the bare minimum:

# file OurTest.rakumod
unit module OurTest;

use NativeCall;

our $our-errno is export := cglobal('libc.so.6', 'errno', int32); # note the "our"
# file test.raku
use NativeCall;
use lib '.';
use OurTest;

my $my-errno := cglobal('libc.so.6', 'errno', int32); # note the "my"

say $my-errno.^name;   # output: Int
say $our-errno.^name;  # output: Any

Why do the variables declared as my and our seem to contain different type of data?
No hint of that behavior in the documentation, this was unexpected to me.

0

There are 0 best solutions below