I have a Python script, I renamed the script to .pyx file. I want compile this code to a stand dll file.
I saw in this document that Cython will create a dll file, but i only get a pyd.
I have mingw and try to use command python setup.py build --compiler=mingw32
to compile the script my code (just a hello world):
def init():
return "hello world"
Any ideas? Thanks
So the first thing to do is rename the file to helloworld.pyx. Now we need to make the setup.py, which is like a python Makefile (for more information see Compilation). Your setup.py should look like:
To use this to build your Cython file use the commandline options:
Which will leave a file in your local directory called helloworld.so in unix or helloworld.dll in Windows.
Now to use this file: start the python interpreter and simply import it as if it was a regular python module:
Modifying Python’s Search Path, Absolute and Relative Imports