Nim is a statically typed compiled systems programming language. It combines successful concepts from mature languages like Python, Ada and Modula. Its design focuses on efficiency, expressiveness, and elegance (in that order of priority).
I got compile error when use {.global.} pragma with proc input arg.
Example
proc fun(x: string) =
let r {.global.} = x
fun("")
Current Output
$ LANG=C nim c --run tmp/gn
Hint: used config file '/home/unikum/.choosenim/toolchains/nim-1.6.4/config/nim.cfg' [Conf]
Hint: used config file '/home/unikum/.choosenim/toolchains/nim-1.6.4/config/config.nims' [Conf]
.........................................................
/run/media/unikum/UNIKUM-STORAGE/private/prog/nim/nim-uap/tmp/gn.nim(2, 7) Hint: 'r' is declared but not used [XDeclaredButNotUsed]
CC: gn.nim
/home/unikum/.cache/nim/gn_d/@mgn.nim.c: In function 'NimMainModule':
/home/unikum/.cache/nim/gn_d/@mgn.nim.c:343:53: error: 'x' undeclared (first use in this function)
343 | T100001_ = r__gn_3; r__gn_3 = copyStringRC1(x);
| ^
/home/unikum/.cache/nim/gn_d/@mgn.nim.c:343:53: note: each undeclared identifier is reported only once for each function it appears in
Error: execution of an external compiler program 'gcc -c -w -fmax-errors=3 -I/home/unikum/.choosenim/toolchains/nim-1.6.4/lib -I/run/media/unikum/UNIKUM-STORAGE/private/prog/nim/nim-uap/tmp -o /home/unikum/.cache/nim/gn_d/@mgn.nim.c.o /home/unikum/.cache/nim/gn_d/@mgn.nim.c' failed with exit code: 1
Expected Output
Additional Information
$ nim -v
Nim Compiler Version 1.6.4 [Linux: amd64]
Compiled at 2022-02-09
Copyright (c) 2006-2021 by Andreas Rumpf
git hash: 7994556f3804c217035c44b453a3feec64405758
active boot switches: -d:release
I got compile error when use
{.global.}
pragma with proc input arg.Example
Current Output
Expected Output
Additional Information