void pointers with SWIG

Lyle Johnson lyle at users.sourceforge.net
Thu Mar 13 00:49:32 CET 2003

Steve Hanawalt wrote:

> I've tried various typemaps, but I can't seem to get it to work.  I
> keep getting an error in Python like: "Expected _p_PVOID"

Before the declaration of functions like FT_ListDevices() that use the 
PVOID type, you need to have a typemap defined for PVOID, e.g.

     %typemap(in) PVOID {
         /* code to convert Python input to a PVOID */

     FT_STATUS FT_ListDevices(
         PVOID pvArg1,
         PVOID pvArg2,
         DWORD Flags

Having said that, it is criminal that the library's author(s) have 
overloaded the FT_ListDevices() function in such an insane way. I agree 
with the other reply to your post, which recommended writing a little 
wrapper library of some kind around this C API and then using SWIG or 
Boost to wrap that instead.

Hope this helps,


More information about the Python-list mailing list