Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- We have a c source file: something.c
- [source, c]
- ------------------
- int xmode(char** str)
- {
- (*str)[0] = 'X';
- (*str) ++; // xmode modified *str
- return 0;
- }
- ------------------
- Setup a perl6 file, use NativeCall call function xmode: something.p6
- [source, perl6]
- -----------------
- #!/usr/bin/env perl6
- use v6;
- use NativeCall;
- sub xmode(CArray[Str]) returns int32 is native('xmode') { * }
- my CArray[Str] $astr .= new;
- $astr[0] = "54654";
- say xmode($astr);
- say $astr[0]; // rakudo output -> "4654"
- -----------------
- So, how to get orignal string "X4654" in pelr6 side .
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement