-
-
Save niner/6cc82bfcbb6615acadd0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
struct foo { | |
int x; | |
}; | |
void foo_init(struct foo **f) { | |
*f = malloc(sizeof(struct foo)); | |
printf("malloc'd, pointer = %p\n", (void *) *f); | |
} | |
void foo_shutdown(struct foo *f) { | |
printf("freeing, pointer = %p\n", (void *) f); | |
free(f); | |
} | |
void foo_test() { printf("foo\n"); } | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use NativeCall; | |
class foo is repr('CPointer') { } | |
sub foo_init(foo is rw) | |
is native('./test') | |
{ * } | |
sub foo_shutdown(foo) | |
is native('./test') | |
{ * } | |
my foo $p = foo.new; | |
foo_init($p); | |
foo_shutdown($p); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment