I found that when we attempt to use the DLL generated by GO we get the following error:
fatal error: bad sweepgen in refill
runtime stack:
runtime.throw({0x807f8e?, 0xc0000c3df8?})
C:/Program Files/Go/src/runtime/panic.go:992 +0x76
runtime.(*mcache).refill(0x271caaf0a28, 0x2)
C:/Program Files/Go/src/runtime/mcache.go:156 +0x1ec
runtime.(*mcache).nextFree(0x271caaf0a28, 0x2)
C:/Program Files/Go/src/runtime/malloc.go:886 +0x85
runtime.mallocgc(0x8, 0x7f69a0, 0x1)
C:/Program Files/Go/src/runtime/malloc.go:1085 +0x40c
runtime.growslice(0x7f69a0, {0x0?, 0x76ad79?, 0x7be52d?}, 0xec7e1ff708?)
C:/Program Files/Go/src/runtime/slice.go:278 +0x28d
runtime.doaddtimer(0x1c000032a00, 0xc0000e0000)
C:/Program Files/Go/src/runtime/time.go:295 +0x95
runtime.modtimer(0xc0000e0000, 0x5af67e66487c, 0x0, 0x80d220, {0x7f6160?, 0xc00004a000}, 0x0)
C:/Program Files/Go/src/runtime/time.go:493 +0x27c
runtime.resettimer(0x86a618?, 0x86a040?)
C:/Program Files/Go/src/runtime/time.go:540 +0x2d
runtime.resetForSleep(0xc00004a000?, 0x400000002?)
C:/Program Files/Go/src/runtime/time.go:203 +0x25
runtime.park_m(0xc00004a000?)
C:/Program Files/Go/src/runtime/proc.go:3325 +0x8b
runtime.mcall()
C:/Program Files/Go/src/runtime/asm_amd64.s:425 +0x4a
goroutine 1 [sleep]:
time.Sleep(0x3b9aca00)
When generating the DLL with g++
the module replacement works as expected.
And it's possible to replace the function while the main program is still running.
Relevant reported issues:
Alternatives (to review in the future):