[C++-sig] Pyplusplus - anonymous union

Jan Langer jan at langernetz.de
Thu Jul 20 13:39:16 CEST 2006


Hello,
I'm using pyplusplus to generate python-bindings for a C API. However,
there are several unions, and I just don't know how to handle them. The
following example code from the API:

typedef struct
{
	int offset;
	int dataType;
	union
	{
		char *sdata;
		int idata;
	} u;
} A;

generates this Boost.Python code:

bp::class_< A >( "A" )
	.def_readwrite( "offset", &A::offset )
	.def_readwrite( "dataType", &A::dataType )
	.def_readonly( "u", &A::u );

and it does not compile on gcc 3.3.2 with this error:

 error: template-argument
	`A::<anonymous union> A::*' uses anonymous type

Is there a solution? I have already searched the news archives, but
haven't found useful hints.

Thanks,
Jan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 252 bytes
Desc: OpenPGP digital signature
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20060720/26ae0b7b/attachment.pgp>


More information about the Cplusplus-sig mailing list