Currently, I am using Python 3.4 out of the Anaconda Suite. I have a file called "libPiCam.dll" within my working directory and I am trying to load it in this fashion:
from ctypes import cdll
def load(x):
"""Loads DLL library where argument is location of library"""
x = cdll.LoadLibrary(x)
return x
lib = load("PiCamLib")
But when doing that, I get this tracer back
Traceback (most recent call last):
File "<ipython-input-27-8d86fac88101>", line 1, in <module>
runfile('C:/Users/User/Documents/Python Scripts/PicamCode/PixisTest.py', wdir='C:/Users/User/Documents/Python Scripts/PicamCode')
File "C:\Users\User\Anaconda3\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 685, in runfile
execfile(filename, namespace)
File "C:\Users\User\Anaconda3\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 85, in execfile
exec(compile(open(filename, 'rb').read(), filename, 'exec'), namespace)
File "C:/Users/User/Documents/Python Scripts/PicamCode/PixisTest.py", line 49, in <module>
piFunction = load(piFunctionLib)
File "C:/Users/User/Documents/Python Scripts/PicamCode/PixisTest.py", line 32, in load
x = cdll.LoadLibrary(x)
File "C:\Users\User\Anaconda3\lib\ctypes\__init__.py", line 429, in LoadLibrary
return self._dlltype(name)
File "C:\Users\User\Anaconda3\lib\ctypes\__init__.py", line 351, in __init__
self._handle = _dlopen(self._name, mode)
OSError: [WinError 193] %1 is not a valid Win32 application
What confuses me the most is that I have a file called "PiCam.dll" and load it in this fashion:
picamLibrary = 'picam'
picam = cdll.LoadLibrary(picamLibrary)
And loads using th eLoad method above. This works without error. I tried shaping my call to load libPiCam to be the same way, but I get the same error. As background, I created and compiled the "libPiCam.dll" file from a C++ file in order to wrap it, allowing me to call C++ functions from Python (I followed Calling C/C++ from python?).
So, what do I do?