Call a DLL function with argument type as unsigned char *

B

Bhavik

Hello,

I am a newbie to the python language, and I need to call a DLL
function from the python program.
The DLL function has following prototype:

unsigned int DLLFunction(unsigned char *, unsigned int);

Now, I need to declare an array of 6 bytes in the python, and pass
that array as the first argument to the DLL function. I tried some
methods mentioned on the Internet, but it gives error like "can not
convert argument 1".

Can someone tell me how to do this?

Thanks for the help.
 
S

Steve Holden

Bhavik said:
Just to clarify, I am using Python 2.5.1
Take a look at the ctypes module, which allows you to do such things (at
the risk of segmentation faults and the like if you get your calls wrong).

regards
Steve
 
Joined
Mar 21, 2010
Messages
1
Reaction score
0
Hi,
same problem with python-ftdi.
I get: "TypeError: in method 'ftdi_write_data', argument 2 of type 'unsigned char *'"
I have tried ctypes without succes. type(addressof(c_ubyte)) is int, and there isn't any c_ubyte_p.
Am I doing something wrong or is there any way to cheat it?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,074
Latest member
StanleyFra

Latest Threads

Top