I have C++ code which has a function which takes, three arguments
- Pointer argument
- LPWSTR argument
- (LPWSTR variable)reference as argument Below is the C++ Code syntax
HRESULT WINAPIV GIDItem (Address* pa, LPWSTR cmdvalue, LPWSTR* string_value)
I am able to load the dll in Ctypes
import ctypes
uDl = ctypes.CDLL(r"test1")
uDl_function=uDl.CAIA # we are creating function pointer
pa=uDl_function('something')
uD = ctypes.CDLL(r"test.dll")
uD_function =uD.GIDItem # we are creating function pointer
string_value= ctypes.c_wchar_p()
cmdvalue=ctypes.c_wchar_p("CM")
dI=uD_function(ctypes.POINTER(pa),cmdvalue,ctypes.byref(string_value))
I am getting below error,
dI=uD_function(ctypes.POINTER(pa),cmdvalue,ctypes.byref(string_value))
TypeError: must be a ctypes type
I was just looking some article about that DLL, in C++ the Dll been called like below
fpGIDItem (pA, L"CMD", &cD)
When you look to the above code "CMD" is the cmdvalue and string value is sent with &cD
Please help me over this
pais declared. Am I missing something?pa.Thanks for looking to thisPOINTERis a type and you need an instance of a type. Since the first parameter isAddress*is can probably be justpaif that is what is returned from the first function.byref(string_value)is actually passing awchar_t**which isn't what you want either. Just passstring_value. Update your question with the full C prototypes of both functions if you want a better answer.