Python Windll - passing python lists to DLL function using Windll

Robin Becker robin at
Thu Aug 1 12:48:09 CEST 2002

In article <ad5b37b7.0207311413.7a1bfd4 at>, SK
<skunix at> writes
>I have a function named TestMap() with the following prototype:-
>void TestOpenCluster(_InputParamMap MapStateBefore);
>    typedef std::map<char**,char**> _InputParamMap ;
>How do I pass the python list to this function using Windll? I got an
>AV with the following code?
>import windll
>arr =[    (windll.cstring('VAR1'),windll.cstring('VALUE1')), 
>          (windll.cstring('VAR2') , windll.cstring('VALUE2'))
>     ]
>modl = windll.module('MyTestDll')
>Exception exceptions.AttributeError: "cstring instance has no
>attribute 'mb'" in  ignored
>Traceback (most recent call last):
>  File "<stdin>", line 1, in ?
>  File "C:\Python22\", line 44, in __call__
>    args
>TypeError: an integer is required
>Thanks in Advance.
I think you need to use structob.struct_object + oracle.Oracle or
windll.membuf to create the required arrays somehow. 

I'm fairly sure that windll doesn't handle converting lists/tuples

With windll.membuf your length two char** things are 2*4 bytes long

so I guess uncertainly

A0 = windll.membuf(8)
A0[0] = int(windll.cstring('VAR1'))
A0[4] = int(windll.cstring('VALUE1'))

A1 = windll.membuf(8)
A1[0] = int(windll.cstring('VAR2'))
A1[4] = int(windll.cstring('VALUE2'))

modl = windll.module('MyTestDll')

let's hear if that's right/wrong?
Robin Becker

More information about the Python-list mailing list