Besides embedsrc, see also [https://nim-lang.org/docs/nimc.html#compiler-usage-command-line-switches](https://nim-lang.org/docs/nimc.html#compiler-usage-command-line-switches) . The``genMapping`` option may be useful too.
I'm not sure this is what you are asking, but if you want to know how the code generator actually produces the target code, my suggestion is to read `compiler/jsgen.nim` first, which is the js code generator and is a lot simpler than the c/c++ one (which is divided in various files, the actual pass is in `compiler/cgen.nim` if I remeber rigth)
