Passing an array of structures to a Perl 6 NativeCall function
问题 I'm trying to use NativeCall to interact with some C functions. I have a simple C struct, and a function that wants an array of them. struct foo { int x; char *s; }; struct foo foo_array[3]; foo_array[0].x = 12; foo_array[0].s = "foo"; foo_array[1].x = 27; foo_array[1].s = "bar"; foo_array[2].x = -1; void somefunc(foo_array); I've tried a bunch of ways, but can't seem to get it quite right. class foo is repr('CStruct') { has int32 $.x; has Str $.s }; sub somefunc(CArray[foo]) is native { * }