This code:
    
    
    static:
      var foo = "test"
    echo foo
    

generates broken code:
    
    
    2 $  nim compile test_static.nim
    Hint: used config file '/home/bkerin/opt/nim-0.17.2/config/nim.cfg' [Conf]
    Hint: used config file '/home/bkerin/.config/nim.cfg' [Conf]
    Hint: system [Processing]
    Hint: test_static [Processing]
    gcc -c  -w  -I/home/bkerin/opt/nim-0.17.2/lib -o 
/home/bkerin/projects/upcb/nimcache/test_static.o 
/home/bkerin/projects/upcb/nimcache/test_static.c
    Error: execution of an external compiler program 'gcc -c  -w  
-I/home/bkerin/opt/nim-0.17.2/lib -o 
/home/bkerin/projects/upcb/nimcache/test_static.o 
/home/bkerin/projects/upcb/nimcache/test_static.c' failed with exit code: 1
    
    /home/bkerin/projects/upcb/nimcache/test_static.c: In function 
‘NimMainModule’:
    /home/bkerin/projects/upcb/nimcache/test_static.c:104:19: error: 
‘foo_gGf7nGBFMKl3DkCtR0dVkg’ undeclared (first use in this function)
      printf("%s\012", foo_gGf7nGBFMKl3DkCtR0dVkg? 
(foo_gGf7nGBFMKl3DkCtR0dVkg)->data:"nil");
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~
    /home/bkerin/projects/upcb/nimcache/test_static.c:104:19: note: each 
undeclared
    identifier is reported only once for each function it appears in
    

It would be quite handy for me to be able to use some stuff built up at 
compile-time again to do some corresponding run-time work. I guess it would all 
need to turn into const  Is there some simple way to do that? 

Reply via email to