I need to interface with a windows DLL that has the following
signature
extern "C" void Foo( BSTR in, BSTR *out )
Code so far
Traceback (most recent call last):
File "<pyshell#1 4>", line 1, in <module>
hdl(inStr,byref (out))
TypeError: byref() argument must be a ctypes instance, not
'_ctypes.Simple Type'
Also tried the following
Traceback (most recent call last):
File "<pyshell#1 9>", line 1, in <module>
hdl(inStr,p)
ValueError: Procedure probably called with too many arguments (8 bytes
in excess)
Any feedback would be appreciated.
signature
extern "C" void Foo( BSTR in, BSTR *out )
Code so far
>>from ctypes import *
>>import comtypes
>>LPBSTR = POINTER(comtype s.BSTR)
>>>
>>hdl = windll.MyDll.Fo o
>>hdl.rettype = None
>>hdl.argtype s = [comtypes.BSTR, LPBSTR]
>>>
>>inStr = comtypes.BSTR(u 'Some Silly String')
>>out = comtypes.BSTR
>>>
>>hdl(inStr,byr ef(out))
>>import comtypes
>>LPBSTR = POINTER(comtype s.BSTR)
>>>
>>hdl = windll.MyDll.Fo o
>>hdl.rettype = None
>>hdl.argtype s = [comtypes.BSTR, LPBSTR]
>>>
>>inStr = comtypes.BSTR(u 'Some Silly String')
>>out = comtypes.BSTR
>>>
>>hdl(inStr,byr ef(out))
File "<pyshell#1 4>", line 1, in <module>
hdl(inStr,byref (out))
TypeError: byref() argument must be a ctypes instance, not
'_ctypes.Simple Type'
Also tried the following
>>out = comtypes.BSTR(u '')
>>p = pointer(out)
>>hdl(inStr,p )
>>p = pointer(out)
>>hdl(inStr,p )
File "<pyshell#1 9>", line 1, in <module>
hdl(inStr,p)
ValueError: Procedure probably called with too many arguments (8 bytes
in excess)
Any feedback would be appreciated.
Comment