ctypes & strings

Red Rackham redrackem at yahoo.com
Wed Dec 24 20:07:27 EST 2008


Hi friends;
 
I would like to pass a string into a dll function.  I notice that to pass using ctypes, it has to be a ctypes type.  Looking at the ctypes doc page I don't see a c_string class.  
 
I tried to pass in byref("name of string") and got back "TypeError: byref() argument must be a ctypes instance, not 'str'"
 
If I use astr = create_string_buffer( "name of string" ), and try to pass that in, I get "ValueError: Procedure probably called with too many arguments (4 bytes in excess)".
 
If I use astr = (c_char*255)("name of string"), I get "TypeError: one character string expected" (on this line).
 
Could some benevolet expert please clue me in on how to accomplish this?
 
Thanks!!!!
 
Mark
 
 
 


      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20081224/eecc34a5/attachment-0001.html>


More information about the Python-list mailing list