I followed the docs and compiled with nim compileToC helloworld.nim
but it just spit out an executable. How can I see the intermediate C representation?
How do I get the c code of a nim program?
2019 Update (Nim 0.19.2)
The default nimcache directory has changed from the current working directory to:
$HOME/.cache/nim/<project_name>
for Linux and MacOS$HOME/nimcache/<project_name>
for Windows
See the relevant nim compiler documentation article for details.
nim -c -d:release c helloworld.nim
just creates the C files in nimcache
, without compiling and linking them. -d:release
makes the code easier to read.
Solved: When you compile a nim program a nimcache
directory is automatically generated in the same directory that contains the c code.
Not for a while, it seems. Nothing is generated in the working directory in 0.19. –
Boykins
© 2022 - 2024 — McMap. All rights reserved.
nimcache
location depends on OS, on my system the C files ended up under~/.cache/nim/
, in a directory named after each nim source file, with suffix_d
or_r
, presumably for "debug" and "release". You can control this with--nimcache:...
command line switch. – Octans