I'm fairly new to Python and I'm trying to use ctypes to use a .dll library
It comes out with error " winerror 193 1 is not a valid win32 application"
This is the c code that I use to create the .dll
__declspec(dllexport) int sum(int a, int b) {
return a + b;
}
and this is the python code where I'm trying to import the dll
from ctypes import cdll
mydll = cdll.LoadLibrary('libTest.dll')
if __name__ == '__main__':
pass
It's fairly simple, but when I try to run it I get all this bunch of errors
Traceback (most recent call last):
File "C:\Users\robertodg\.p2\pool\plugins\org.python.pydev.core_6.4.3.201807050139\pysrc\_pydev_runfiles\pydev_runfiles.py", line 468, in __get_module_from_str
mod = __import__(modname)
File "C:\Users\robertodg\eclipse-workspace\LetsHope\Hope.py", line 8, in <module>
mydll = cdll.LoadLibrary('libTest.dll')
File "C:\Users\robertodg\AppData\Local\Programs\Python\Python37-32\lib\ctypes\__init__.py", line 434, in LoadLibrary
return self._dlltype(name)
File "C:\Users\robertodg\AppData\Local\Programs\Python\Python37-32\lib\ctypes\__init__.py", line 356, in __init__
self._handle = _dlopen(self._name, mode)
OSError: [WinError 193] %1 is not a valid win32 application
I'm using eclipse on windows with the c and python prospective and I'm using and this is the python that I'm running Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:06:47) [MSC v.1914 32 bit (Intel)] on win32
I know that it's prob something really simple, but I've been banging my head for 2 days now.
thanks in advance