Pragma to force the exportc of a type. #21645 (#21648)

exportc export all types not just those used by exported proc/globals

Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
This commit is contained in:
Juan M Gómez
2023-04-24 16:44:29 +01:00
committed by GitHub
parent 0f226c0e48
commit 4754c51f1b

View File

@@ -1612,11 +1612,20 @@ proc genTypeInfoV1(m: BModule; t: PType; info: TLineInfo): Rope =
result = prefixTI.rope & result & ")".rope
proc genTypeSection(m: BModule; n: PNode) =
discard
proc genTypeInfo*(config: ConfigRef, m: BModule; t: PType; info: TLineInfo): Rope =
if optTinyRtti in config.globalOptions:
result = genTypeInfoV2(m, t, info)
else:
result = genTypeInfoV1(m, t, info)
proc genTypeSection(m: BModule, n: PNode) =
var intSet = initIntSet()
for i in 0..<n.len:
if len(n[i]) == 0: continue
if n[i][0].kind != nkPragmaExpr: continue
for p in 0..<n[i][0].len:
if (n[i][0][p].kind != nkSym): continue
if sfExportc in n[i][0][p].sym.flags:
discard getTypeDescAux(m, n[i][0][p].typ, intSet, n[i][0][p].sym.kind)
if m.g.generatedHeader != nil:
discard getTypeDescAux(m.g.generatedHeader, n[i][0][p].typ, intSet, n[i][0][p].sym.kind)