I am trying to import a DLL into Python 2.7.12 64 bit using ctypes. To narrow down the scope for errors I used Microsoft's MathLibrary DLL example and built my own based on these instructions (https://msdn.microsoft.com/en-GB/library/ms235636.aspx). I built it as x64 release and copied the resulting dll into C:\ root to eliminate path length or spelling error issues. My machine us running Windows 7 Pro 64 Bit.
My python code is:
from ctypes import cdll, windll, c_long, c_int, create_string_buffer
test_dll = windll("C:\\MathLibrary.dll")
add = test_dll.add
When run it reports the following:
Traceback (most recent call last):
File "C:\temp.py", line 3, in <module>
test_dll = windll("C:\\MathLibrary.dll")
TypeError: 'LibraryLoader' object is not callable
Can anyone advise what might be the issue?
Thanks
Andy
Update:
@eryksun comment - this removed the LibraryLoader error. However I am now struggling to access the add function and get this error:
add = test_dll.add
File "C:\Python27\lib\ctypes\__init__.py", line 375, in __getattr__
func = self.__getitem__(name)
File "C:\Python27\lib\ctypes\__init__.py", line 380, in __getitem__
func = self._FuncPtr((name_or_ordinal, self))
AttributeError: function 'add' not found