[C++-sig] exposing built-in type pointer
Thomas Rab
thomas.rab at gmail.com
Wed Oct 1 11:39:32 CEST 2008
I'm new boost python. After a few nights of trying to figure out this problem
and trying to search for a solution, I finally decided to start a post.
Anyway, I'm wrapping an existing API, so I unfortunately can't change the actual
code, but here's my problem. There's a class:
class foo
{
public:
X x;
};
bar is actually a typedef for: const unsigned int* bar;
Basically I need x to create another object:
class bar
{
public:
bar(X x);
};
I've tried this:
class_<foo>("foo")
.def_readonly("x",&foo::x)
Which obviously doesn't work because python's integer type is immutable.
Basically what I want to do in python is this:
foo = foo()
bar = bar(foo.x)
This is the perfect outcome though, I'll just be happy if I'm able to access x,
so I can pass it to bar.
If I've not left enough information let me know, so I can explain/add more.
Sorry for the horrible class/variable names.
More information about the Cplusplus-sig
mailing list