fix & add test for basic hot code reloading case (#21915)

fixes #21885
This commit is contained in:
metagn
2023-05-26 18:07:37 +03:00
committed by GitHub
parent 656706026b
commit 1aaff9dc48
3 changed files with 12 additions and 1 deletions

View File

@@ -2180,7 +2180,10 @@ proc finalCodegenActions*(graph: ModuleGraph; m: BModule; n: PNode): PNode =
if m.hcrOn:
# make sure this is pulled in (meaning hcrGetGlobal() is called for it during init)
cgsym(m, "programResult")
let sym = magicsys.getCompilerProc(m.g.graph, "programResult")
# ignore when not available, could be a module imported early in `system`
if sym != nil:
cgsymImpl m, sym
if m.inHcrInitGuard:
endBlock(m.initProc)

View File

@@ -80,6 +80,7 @@ proc runBasicDLLTest(c, r: var TResults, cat: Category, options: string, isOrc =
testSpec r, makeTest("tests/dll/client.nim", options & " --threads:on" & rpath, cat)
testSpec r, makeTest("tests/dll/nimhcr_unit.nim", options & " --threads:off" & rpath, cat)
testSpec r, makeTest("tests/dll/visibility.nim", options & " --threads:off" & rpath, cat)
testSpec r, makeTest("tests/dll/nimhcr_basic.nim", options & " --threads:off" & rpath, cat)
if "boehm" notin options:
# force build required - see the comments in the .nim file for more details

View File

@@ -0,0 +1,7 @@
discard """
output: '''
Hello world
'''
"""
echo "Hello world"