Closed mhechthz closed 3 years ago
@mhechthz can you post the nim.cfg?
It's the default nim.cfg, with the only change
# cc = gcc
cc = clang
How can I be sure, that this config file from Nim installation directory is really used? I set the PATH to NimInstallDir\bin.
EDIT: It seems that LLVM is using MSVC++ during linking. That's probably the reason why I see this running. Nevertheless, it doesn't work
Hello @mhechthz I was able to get both of the code snippets to work on my Windows 10 machine using MSVC.
Nimporter can't change Nim's behavior for supporting nim.cfg
files so if the nim.cfg
is in the proper directory as specified by the docs it will work with Nimporter.
However, you mentioned that "Visual Studio" (the graphical application) starts up when you run the Python example above?
Also, Nimporter will tell Nim to use MSVC only if Python was compiled with MSVC. You can tell if Python is compiled with MSVC by running this in a Python shell:
>>> import sys; sys.version
'3.7.3 (v3.7.3:ef4ec6ed12, Mar 25 2019, 22:22:05) [MSC v.1916 64 bit (AMD64)]'
The "MSC" in the square brackets is for MSVC. If "MSC" is not in sys.version
, Nimporter does not suggest a compiler, which means that the cc = clang
should be honored by Nim itself (since Nimporter will not have asked Nim to use MSVC manually).
If you need to explicitly control 100% of all flags Nimporter passes to Nim, you can use a switches.py script.
Closing for now
Hi,
I'm totally new to Nim and nimporter and tried to build a little test application. I changed Nim to use clang, which is compatible with CPython on Windows 10. Nim file:
Python file:
Running the nim-file using Nim works perfectly. Compiling to library (nimpy only) and importing to Python also works perfectly.
Running the Python program "hangs" the execution and while trying to start Visual C++. Both files are in the same directory, i.e. there is no directory structure.
What is wrong here?