Skip to content

Instantly share code, notes, and snippets.

use nqp;
my $SIG_ELEM_BIND_CAPTURE := 1;
my $SIG_ELEM_BIND_PRIVATE_ATTR := 2;
my $SIG_ELEM_BIND_PUBLIC_ATTR := 4;
my $SIG_ELEM_SLURPY_POS := 8;
my $SIG_ELEM_SLURPY_NAMED := 16;
my $SIG_ELEM_SLURPY_LOL := 32;
my $SIG_ELEM_INVOCANT := 64;
my $SIG_ELEM_MULTI_INVOCANT := 128;
my @initial = (1..15).List.pick(15);
use NativeCall;
sub malloc(size_t --> Pointer) is native { * };
sub memcpy_A(Buf, Pointer, size_t) is native is symbol("memcpy") { };
sub memcpy_B(Pointer, Buf, size_t) is native is symbol("memcpy") { };
sub qsort(Pointer, size_t, size_t, &compar (Pointer, Pointer --> Pointer)) is native { * };
my $data = Buf[uint8].new(@initial);
my $ptr = malloc(15);