[C++-sig] Pointers to simple types, arrays and arrays of pointers to types

Niall Douglas s_sourceforge at nedprod.com
Sun Oct 5 04:26:18 CEST 2003


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

My apologies if this is really simple. I did search ASPN and didn't 
get anything relevent after 20 mins, so ...

I have everything compiling except for eight of over 100 source files 
(thanks again to everyone here!). Most of these won't compile because 
some method returns a pointer to a simple type eg;

typedef unsigned long FXColor;

class FXImage
{
public:
    FXColor* getData() const;
};

using namespace boost::python;

void Export_FXImage()
{
    class_< FXImage >("FXImage")
		.def("getData", &FXImage::getData, return_internal_reference< 1 
>())
    ;
};

This won't compile because FXColor is not a class. Ideally I'd like 
the python side to be able to access the array of FXColor's being 
returned - no limits are needed because other methods return the 
length.

In other places still I have a find() function returning a pointer to 
a single float for example. In this situation I'd want the float to 
dereference to a float if the pointer is not null, otherwise return 
none. But if I use a thin wrapper, it can only return float and not 
none! :(

Lastly, some other methods return a type ** ie; an array of pointers 
to object instances. How on earth can this get wrapped? Is that 
indexing suite the right answer for these?

Cheers,
Niall





-----BEGIN PGP SIGNATURE-----
Version: idw's PGP-Frontend 4.9.6.1 / 9-2003 + PGP 8.0.2

iQA/AwUBP3+BS8EcvDLFGKbPEQL3GACgp/x+bIF9eJ6D2ge202gv/WvqXHcAoM3U
GXynK12l5N07P/c78kGr4O82
=Af9Z
-----END PGP SIGNATURE-----




More information about the Cplusplus-sig mailing list