RosettaCodeData/Task/Call-a-foreign-language-function/Perl-6/call-a-foreign-language-function.pl6

10 lines
261 B
Raku
Raw Permalink Normal View History

2013-04-10 22:43:41 -07:00
use NativeCall;
sub strdup(Str $s --> OpaquePointer) is native {*}
2016-12-05 22:15:40 +01:00
sub puts(OpaquePointer $p --> int32) is native {*}
sub free(OpaquePointer $p --> int32) is native {*}
2013-04-10 22:43:41 -07:00
my $p = strdup("Success!");
say 'puts returns ', puts($p);
say 'free returns ', free($p);