type
InitSubmodule = proc(mem:seq[string]): Submodule{.gcsafe, cdecl.}
NewSubmodule = proc(mem:seq[string]): Submodule{.gcsafe, cdecl.}
when isMainModule:
const themeFile = currentSourcePath.parentDir / "dllgen" / "theme.nim"
const themePath = currentSourcePath.parentDir / "dllgen" / libThemeName
let cmd = "nim c --gc:boehm -d:createNimRtl " & (when defined(release): "-d:release" else: "") &
" --app:lib --verbosity:0 --hints:off -w:off " & themeFile
let r = execCmdEx(cmd)
if r.exitCode != 0:
removeFile(themePath)
quit(1)
let libTheme = loadLib(themePath)
let initSubmodule = cast[InitSubmodule](libTheme.symAddr("initSubmodule"))
echo initSubmodule(@["a","b"])
let newSubmodule = cast[NewSubmodule](libTheme.symAddr("newSubmodule"))
echo newSubmodule(@["a","b"])
I get
(name: "Anonymous", mem: @["a", "b"])
(name: "", mem: @[])
I'v create a repo to demonstrate this problem.
see the CI result. https://github.com/bung87/dllgen/runs/3015081926?check_suite_focus=true
I'v create a repo to demonstrate this problem.
What is the problem?