ffi: support **:type

This commit is contained in:
dzaima 2022-05-23 16:42:02 +03:00
parent ec76a3cd70
commit 2775a92535

View File

@ -286,7 +286,8 @@ BQNFFIEnt ffi_parseTypeStr(u32** src, bool inPtr) { // parse actual type
myWidth = sizeof(void*);
if (c0=='*' && (0==*c || ':'==*c)) {
ro = m_c32(sty_ptr);
parseRepr = true;
parseRepr = !inPtr;
canRetype = inPtr;
} else {
if (c0=='&') mut = true;
BQNFFIEnt* rp; ro = m_bqnFFIType(&rp, cty_ptr, 1);
@ -437,7 +438,7 @@ usz genObj(BQNFFIEnt ent, B c, bool anyMut) {
if (t->ty==cty_ptr) { // *any / &any
pos = ffiTmpAA(sizeof(void*));
B e = t->a[0].o;
if (!isC32(e)) thrM("FFI: Nested pointers unimplemented");
if (!isC32(e)) thrM("FFI: Complex pointer elements NYI");
inc(c);
B cG;
if (!isArr(c)) thrF("FFI: Expected array corresponding to \"*%S\"", sty_names[o2cu(e)]);