4 ms·
Looks cool already but is it easy to cross-compile? I can copy a Python script from my Linux machine and run it on both Mac and Windows PCs. Can Nim build execu
by qwerty456127 7y ago
Looks cool already but is it easy to cross-compile? I can copy a Python script from my Linux machine and run it on both Mac and Windows PCs. Can Nim build executables for other platforms nearly as easy?
- bloblaw 7y agoWell, you sorta can. As long as you wrote it: * to work in both Python 2 and 3 (no telling what other system's Python will be) * don't use any modules outside of stdlib (that requires install too) Those aren't always requirements, but they are the reason I reach for compiled languages when I can't control the target environment where the program needs to run (or don't want to).
- creatornator 7y agoIn addition to compiler switches that allow you to cross compile from the nim compiler [0], you can compile to c or c++, and then invoke whatever cross-compilation toolchain to compile to more esoteric platforms. [0] https://nim-lang.org/docs/nimc.html#cross-compilation https://nim-lang.org/docs/nimc.html#cross-compilation
- uvtc 7y agoIf cross-compilation is important to you, and you like Nim's level of abstraction, you might have a look at Haxe, which can compile to [lots of different targets](https://haxe.org/documentation/introduction/compiler-targets.html https://haxe.org/documentation/introduction/compiler-targets...).
- iffycan 7y agoYes! I use Nim on macOS to build a Windows exe for bootstrapping a Windows VM. A year ago, you had to dig a little to figure out the right command line incantation, but maybe it's better now.
- refaqtor 7y agocross-compiling to ARM embedded was surprisingly simple
- nimmer 7y agoYes, Nim is cross-platform. It also targets C, C++, Objective-C and Javascript, making it possible to run on platforms where using C is not the preferred choice.