Swig'ed DLL not found in Windows with CMake
patrick <[email protected]> Thu, 23 Dec 2021 13:25:47 +0100
| Newsgroups | gmane.comp.programming.swig |
|---|---|
| Message-ID | <CAEx2pdc_vnKoG7zkz68d26JV5qo94fGrXz9+f2XfidxWUxMxaA@mail.gmail.com> |
Hello,
I am trying to build a Python module with help of Swig on Windows and CMake.
The example I am following is similar to the LAMMPS swig interface here:
https://github.com/ymishin-gmu/LAMMPS-USER-PINN/blob/8c56ef94570325fc660819e4f123376515e8fba3/tools/swig/CMakeLists.txt
swig_add_library(mymod
TYPE MODULE
LANGUAGE python
SOURCES swig/mymod.i formats/import.cc
)
Then I link the lib with:
swig_link_libraries(mymod Python3::Python ${Boost_FILESYSTEM}
${Boost_SERIALIZATION_LIBRARY} )
The build looks good but I am not sure if I should see a .dll which
can be loaded.
When I try to import the lib I get:
(base) C:\CLionProjects\mymod\cmake-build-debug\lib>python
Python 3.9.5 (default, May 18 2021, 14:42:02) [MSC v.1916 64 bit
(AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import mymod
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "...lib\mymod.py", line 15, in <module>
import _mymod
ImportError: DLL load failed while importing _mymod: %1 is not a valid
Win32 application.
What can be done to debug this?
I see a .pyd file , is it enough, or should there be .dll ?
How to check the library has the the right format?
Maybe it is the Python interpreter (Anaconda) vs. the interpreter I
use to build the package (from vcpkg) ?
Thanks a lot for your help!
Patrick
_______________________________________________
Swig-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/swig-user