Accessing Visuall C++ DLL with Python

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Thu Dec 27 01:21:45 EST 2007


En Thu, 20 Dec 2007 16:48:34 -0300, Murray, John <john.murray at amd.com>  
escribió:

> I recently obtained USB device. Other users of the device apparently use
> C or C++ to access it. I am more comfortable with Python and have used
> it for other USB devices on a Windows system. I'm more of a hacker than
> a programmer especially when it comes to Windows. The manufacturor
> supplies xxx.h, xxx.lib and xxx.dll generated using Microsoft Visual
> C++. Are all DLLs made equal? Does the manufacturor need to generate a
> specific dll for Python?

In principle, if you can access the device from a C program, you can do  
the same thing with Python and ctypes. Mismatched C runtimes (between  
Python and the library) might be an issue in some cases, like sharing a  
FILE struct or allocating memory from one side and freeing it on the other  
side. But "sane" APIs (for some definition of sanity) should be usable  
without problems.

-- 
Gabriel Genellina




More information about the Python-list mailing list