void pointers with SWIG

Lyle Johnson lyle at users.sourceforge.net
Wed Mar 12 18:49:32 EST 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,

Lyle





More information about the Python-list mailing list