Can i use 64bit nim compile 32bit program?
use compiler switch --cpu:i386
for example:
nim c --cpu:i386 test.nim
For GCC ,you may have to specify -m32 :
nim c --cpu:i386 -t:-m32 -l:-m32 test.nim
Is this something that can be setup for everyone in the nim config,
so that on linux/win/Mac you can just select one of the following,
and all the settings for your platform and compiler are handled automatically (I am assuming this is possible) ?
Well, you need a C compiler with cross-compiling ability, so doing this reliably platform-independently is not that easy. But you can add something like this to your config/nim.cfg:
@if i386:
cpu = i386
passC = "-m32"
passL = "-m32"
@end
Then you can compile with nim -d:i386 foo or nim -d:i386 -d:release foo.