ctypes: error passing a list of str to a fortran dll

luis solisgb at gmail.com
Mon Jun 4 06:17:26 EDT 2007


I'm using ctypes to call a fortran dll from python. I have no problems
passing integer and double arryas, but I have an error with str arrys.
For example:

....
StringVector = c_char_p * len(id) # id is a list of strings

Id_dat=StringVector()
for i in range(len(Id)):
...Id_dat[i]=id[i]

n=c_int(len(Id_dat))

myDll = windll.LoadLibrary(org)

myDll.myFunc(byref(n), byref(Id_dat))

and then

ValueError: Procedure probably called with not enough arguments (4
bytes missing)

In a similar way I have bo problemns with int or double arryas

Some suggestions are wellcome !




More information about the Python-list mailing list