On Sun, Apr 3, 2016 at 12:28 PM, Tom Browder <tom.brow...@gmail.com> wrote: > I have a module LIBCIO.pm6:
I have pared all code down to a single test file located here: https://github.com/tbrowder/perl6-read-write-tests/blob/master/test-readline.pl6 with its input text file for reading here: https://github.com/tbrowder/perl6-read-write-tests/blob/master/small-file.txt When I run it I get: Native call expected argument that references a native integer, but got P6opaque in method CALL-ME at /home/tbrowde/.rakudobrew/moar-2016.03/install/share/perl6/sources/24DD121B5B4774C04A7084827BFAD92199756E03 line 301 in block <unit> at ./test-readline.pl6 line 27 Rakudo would be more helpful if it could say which argument, but I assume its the input pointer. I would love it if someone could make it work, but the libc function has an address of a pointer in its args and I'm not sure how (or if) that can be handled. Best, -Tom > > unit module LIBCIO; > use NativeCall; > sub fopen(Str, Str) returns Pointer is native('libc') is export { * } > > > I then try to use it in a Perl 6 sub: > > # try NativeCall > use lib '.'; > use LIBCIO; > # get a file pointer > my Str $mode = 'r'; > my $fp = LIBCIO::fopen($ifil, $mode); > > And when attempting to execute it I get: > > Could not find symbol '&fopen' > in block <unit> at ./read-file-test.pl6 line 90 > > Actually thrown at: > in block <unit> at ./read-file-test.pl6 line 90 > > I'm using Rakudo 2016.03 and trying to follow instructions in: > > http://doc.perl6.org/language/nativecall > > What am I doing wrong? > > Thanks. > > Best regards, > > -Tom