I was trying to wrap GDBM and was having problems with typedef struct { char *dptr; int dsize; } datum;
>From /usr/include/gdbm.h (on Debianish system) Since I don't seem to able to pass this sort of structure as use v6; use NativeCall; constant LIB = "libgdbm"; class MyPointer is repr('CPointer') { has Str $.s; } class Datum is repr("CStruct") { has MyPointer $.p; has int $.s; } sub gdbm_open(Str $name, Int $block_size, Int $flags, Int $mode, Str $fatal_func) returns OpaquePointer is native(LIB) { ... } sub gdbm_store(OpaquePointer $dbf, Datum $key, Datum $content, int $flag) returns Int is native(LIB) { ... } my $dbf = gdbm_open('foo.dat', 512, 2, 0o755, ""); my $key = Datum.new(:p(MyPointer(:s("foo")),:s(3)); my $val = $key; my $ret = gdbm_store($dbf, $key, $val, 0); -- 4096R/EA75174B Steve Mynott <steve.myn...@gmail.com>