Mar-05-2024, 02:48 PM
Hello, working on a windows system and I need to import a dll into a python module. I use ctypes
so far so good but then I want to use a function of the dll. From the .h file
I know there is a function with prototype DWORD ICNC_GetDLLVersion().
I want to call from python, I get
How can I find the name of the functions as it is in the .h file ?
Thank you
import ctypes,sys
myLib = ctypes.CDLL("./myDLL.dll") so far so good but then I want to use a function of the dll. From the .h file
I know there is a function with prototype DWORD ICNC_GetDLLVersion().
I want to call from python, I get
>>> myLib.ICNC_GetDLLVersion()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:/msys64/mingw64/lib/python3.10/ctypes/__init__.py", line 387, in __getattr__
func = self.__getitem__(name)
File "C:/msys64/mingw64/lib/python3.10/ctypes/__init__.py", line 392, in __getitem__
func = self._FuncPtr((name_or_ordinal, self))
AttributeError: function 'ICNC_GetDLLVersion' not foundbut I found>>> myLib[1] <_FuncPtr object at 0x00000202951206c0> >>>and the same for the many functions of the dll.
How can I find the name of the functions as it is in the .h file ?
Thank you
