![]() Would appear (see this SO-post for more information). ![]() build/mingw-w64-_1w3Xm/mingw-w64-4.0.4/mingw-w64-crt/crt/crt0_c.c:18: undefined reference to 'WinMain'Ĭollect2: error: ld returned 1 exit status Without this option, an error message like -municode is needed, because for Windows, Cython defines int wmain(int argc, wchar_t **argv) instead of int main(int argc, char** argv).-shared should no longer be used, as the result is no longer a dynamic library (that is what *.pyd-file is after all) but an executable.the C-file is generated by Cython with -embed option: cython -3 -embed foo.pyx) and thus the command line looks as follows: x86_64-w64-mingw32-gcc foo.c -DMS_WIN64 -O2 -I -L -lpython37 -o foo.exe -municode In this case an executable should be build (e.g. One probably should add the proper suffix to the resulting pyd-file, I use the old convention for simplicity here. Thua we use the path to pythonXY.dll (in my case python37) and not pythonXY.lib, as it would be the case for MSVC. It is important, that the python-library ( pythonXY) should be the dll itself and not the lib (see this SO-post). shared-object in Linux-world) will be created. Pyd is just a dll in disguise, thus we need the -shared option, which means a dynamic library (i.e. If it is not done, at least for files generated by Cython the following error message will be generated by the compiler: error: enumerator value for ‘_pyx_check_sizeof_voidp’ is not an integer constantĢ01 | enum In order to build for 圆4 on windows it must be set, but it works out of the box only for MSVC (defining _WIN64 could have slightly different outcomes): It is important to define MS_WIN64-macro (e.g.it is probably Ok to use only use -O2 for optimization and leave empty. ![]() Once the C-code is created/generated, the extension can be build via x86_64-w64-mingw32-gcc -shared foo.c -DMS_WIN64 -O2 -I -L -lpython37 -o foo.pyd So we need the path to the pythonXY.dll which is usually next the the python.exe. DLL: mingw-w64's linker works differently than MSVC's: python-dll and not python-lib is needed.Headers: We need the path to the Python includes.There are however no guarantee, this won't break in the future versions.ĭistutils does not support mingw-w64, so there is no gain in setting up a setup.py-file - the steps must be performed manually.įirst we need some information usually provided by distutils: While mingw-w64-compiler is not really supported (the only supported windows compiler is MSVC), it can be used to create C-extensions or to embed Python. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |