diff --git a/build_all.sh b/build_all.sh index 2ed2233e9..84230c018 100644 --- a/build_all.sh +++ b/build_all.sh @@ -47,5 +47,5 @@ build_nim_csources(){ # Note: if fails, may need to `cd csources && git pull` echo_run bin/nim c --skipUserCfg --skipParentCfg koch -echo_run ./koch boot -d:release +echo_run ./koch boot -d:release -d:nimHasLibFFI echo_run ./koch tools # Compile Nimble and other tools. diff --git a/compiler/evalffi.nim b/compiler/evalffi.nim index 58c505a5b..856410eda 100644 --- a/compiler/evalffi.nim +++ b/compiler/evalffi.nim @@ -95,6 +95,21 @@ proc mapType(conf: ConfigRef, t: ast.PType): ptr libffi.Type = result = addr libffi.type_pointer of tyDistinct, tyAlias, tySink: result = mapType(conf, t[0]) + of tyObject: + var els = newSeq[ptr libffi.Type](t.n.sons.len + 1) + var ty: ptr libffi.Type = cast[ptr libffi.Type](alloc(sizeof(libffi.Type))) + + ty.size = 0 + ty.alignment = 0 + ty.typ = tkSTRUCT + ty.elements = addr els[0] + + els[els.len-1] = nil + for i in 0..".} = cint