Could not load c ++ dll in python

I am trying to use C ++ .dll in Python, but I cannot even load it. I am trying to download the following Python code:

 from ctypes import cdll mydll = cdll.LoadLibrary('SORT_DLL.dll') 

But when I try to run this, I get:

 D:\...\src\SORT_DLL\Debug>UseDll.py Traceback (most recent call last): File "D:\...\src\SORT_DLL\Debug\UseDll.py", line 2, in <module> mydll = cdll.LoadLibrary('SORT_DLL.dll') File "C:\Python27\lib\ctypes\__init__.py", line 443, in LoadLibrary return self._dlltype(name) File "C:\Python27\lib\ctypes\__init__.py", line 365, in __init__ self._handle = _dlopen(self._name, mode) WindowsError: [Error 193] %1 ist keine zulõssige Win32-Anwendung 

The last sentence means that "% 1 is not a valid Win32 application" in English.

I already looked at http://docs.python.org/2/library/ctypes.html#module-ctypes , but this did not solve my problem.

+8
c ++ python dll
source share
2 answers

It looks like you have an incompatible version of Python installed, or the DLL was compiled using the wrong settings. The DLL and the Python interpreter must be either 32 or 64 bits.

+6
source share

Refer to this answer: stack overflow

"ctypes does not work with C ++, on which the example [DLL] is written.

0
source share

All Articles