I have a module LIBCIO.pm6:

  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

Reply via email to