Hi, my goal is to statically compile nimrtl.nim, but
nim c -d:release --opt:size --app:staticlib --dynlibOverrideAll --nimcache:.nimcachelocal --out:nimrtl.lib .nimrtl.nim
fails with a bunch of compiler error on e.g. CC: pure/os.nim In file included from C:Usershunte.choosenimtoolchainsnim-1.6.12libnimcachelocal@mpure@sos.nim.c:7:
C:Usershunte.choosenimtoolchainsnim-1.6.12libnimcachelocal@mpure@sos.nim.c:419:17: error: conflicting types for 'GetTempPathW'; have 'NU32(NU32, NI16 )' {aka 'unsigned int(unsigned int, short int *)'} 419 | N_STDCALL(NU32, GetTempPathW)(NU32 nBufferLength, NI16 lpBuffer);
without the '--dynlibOverrideAll' it compiles fine, I am wondering if I misunderstood the '--dynlibOverrideAll' and I don't need it, or if I am missing something ?
Works fine (but not sure if the lib is 100% valid, it looks like on the first spot, except of some DLL typical overhead code): nim c -d:release --opt:size --app:staticlib --nimcache:.nimcachelocal --out:nimrtl.lib .nimrtl.nim
(Also tried to disable the local cfg files and some other stuff but the command above is the only one working or better not failing at compile time, a brief look into some of the src files didn't helped me either, I am probably just not good enough yet if it comes to Nim, so any help is appreciated)
thx, Holger
- GC would need to be ARC/ORC, otherwise you would need to manually import and call NimMain
- You would need to create what would effectively be Nim header files to import the stdlib's procs
- The compiler wouldn't be able to do many optimizations on stdlib procs, such as ARC sink/lent types
I believe Rust has the option of statically linking the stdlib, but it does things differently and I'm not even sure if I'm remembering correctly whether it does that or not.