[C++-sig] Need to supply (char*) argument

Roman Yakovenko roman.yakovenko at gmail.com
Fri Apr 11 19:58:32 CEST 2008


2008/4/11 Bill Davy <Bill at synectixltd.com>:
> Sorry if this is a bit simple but any help welcome.
>
> I am adding some C++ code to Python.  From Python I want to be able to read
> data from a target device, over USB.  My software does all the hard work and
> I have a class:
>
>
> typedef unsigned __int8  u8;
>
> typedef unsigned __int16 u16;
>
>
>
> typedef int ErrorT;
>
>
>  class ViperUsbC
>      {
>      public:
>      // snip snip
>         ErrorT ReadSlaveMemory(u8 Slave, u16 Offset, u8* pData, u16 Length);
>      // Snip,snip
>      };
>
>  I use swigwin-1.3.34 to wrap it into a module called SHIP.

I don't know how you can achieve this with SWIG, but the general idea
is simple: define another function that read "n" u8 and return them in
some Python object.

The interface you have, could not be exposed as-is to Python.


-- 
Roman Yakovenko
C++ Python language binding
http://www.language-binding.net/



More information about the Cplusplus-sig mailing list