Boost logo

Boost :

From: daveh-lists_at_[hidden]
Date: 2001-10-01 13:11:04


Unfortunately this type of use of pointers is not going to work. You
are most likely going to have to wrap this particular struct up in a
class and deal with the pointers in a similar way to a previous post
( http://groups.yahoo.com/group/boost/message/18015 )

What you could do is make the wrapper class (as described above) for
the void pointer look like a python file object by providing
read/write methods. The union will also require access functions
because of the const char * type, though this is usually easily dealt
with by using an STL string.

Dave Hawkes

--- In boost_at_y..., "Ivan A. Vigasin" <vig_at_P...> wrote:
> On Mon, 1 Oct 2001 daveh-lists_at_c... wrote:
>
> > The simple solution is to just declare the members as read-write
(see
> > http://www.boost.org/libs/python/doc/special.html and look for
> > def_read_write), unless they are pointers,
> Thanks !
>
> > then the solution will
> > depend upon the context in which they are used.
> I have C function, that accepts following struct as argument:
> struct Field
> {
> unsigned id;
> union
> {
> unsigned num;
> const char *name;
> };
> unsigned type;
> void *value; // pointer to data
> unsigned MFSize; // size of data
> unsigned flags;
> };
>
> I want to be able to use it from python.
>
> What it is possible to do with union and pointers. Compiler want's
accept it.
>
> Regards, Ivan <vig_at_p...>
> ICQ: 22181170


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk