Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- use NativeCall;
- class TestStruct_s is repr<CPointer> {
- has Int $!t;
- has Pointer $!tp;
- has Str $!s;
- method print_T {
- say $!t;
- }
- }
- class TestStruct_I_s is repr<CPointer> {
- has TestStruct_s $!cts_V;
- has TestStruct_s $!cts_I;
- has TestStruct_s $!cts_IP;
- has TestStruct_s $!cts_S;
- method cts_V {
- $!cts_V();
- }
- method cts_I(Int $i) {
- my &func_sig = nativecast(:(Int --> TestStruct_s), $!cts_I);
- return &func_sig($i);
- }
- }
- sub createTestStruct()
- is native('libtest') returns TestStruct_I_s
- { * };
- sub main {
- my $tsi = createTestStruct();
- my $ts = $tsi.cts_I(4);
- say $ts.WHAT;
- say $ts.print_T;
- say "DONE!";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement