Re: How to use NativeCall with a libc function?

2016-04-04 Thread Tom Browder
On Mon, Apr 4, 2016 at 10:45 AM, Timo Paulssen wrote: > Hey Tom, > > in NativeCall, "is rw" has a very special meaning. For example, if you have > "int32 $foo is rw", you'll actually give the native function a pointer to an > int, and perl6 will make that work out for you

Re: How to use NativeCall with a libc function?

2016-04-04 Thread Timo Paulssen
Hey Tom, in NativeCall, "is rw" has a very special meaning. For example, if you have "int32 $foo is rw", you'll actually give the native function a pointer to an int, and perl6 will make that work out for you properly if you have an "int" or an "Int" variable that you pass. Apparently we

How to use NativeCall with a libc function?

2016-04-03 Thread Tom Browder
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 =