I have a C++ dll which I'm trying to use it in Python,
>>> from ctypes import *
>>> mydll = cdll.LoadLibrary("C:\\TestDll.dll")
until now there are no errors, system seem to be doing what I wanted, but when I try to access mydll
, the Intellisence in the Python IDLE shows the following,
from the above pic, it's clear that the intellisence doesn't show up any available functions of the dll, but when I checked the same TestDll.dll with dumpbin /EXPORTS TestDll.dll
it has 45 functions, but none of those functions are available with python.
Please Note: There are several questions on this topic, I tried the following suggestions but no use,
- incompatible version of Python installed or the DLL [TestDll.dll & Python both are 32 bit versions]
- I think ctypes is the way to go [Same Issue, cant see any functions, but loads the dll]
Now my question is how do I load all the available functions(as shown by dumpbin)?
Edit 1
Based on eryksun suggestion, I was able to make some progress. The TestDll.dll
comes along with a header file TestDll.h
(my bad I missed this file earlier), from which I could see the available Exported Functions.
TestDll.h:
_stdcall Function1 (const char* prtFileString, cont char* prtDescrip, struct FileParams* ptrParsms);
struct FileParams
{
float val1;
void* pMarker;
};
now I've tried the following,
>>> mydll = CDLL("c:\\TestDll.dll")
>>> Function1 = mydll.Function1
>>> Function1.restype = c_int
until now it's fine, but when I try to define the argTypes, not sure how to do it for structs?
>>> Function1.argtypes = (c_char_c, c_char_c, ???)
any suggestions are much appreciated.