On 11.10.2010 22:01, Jim Bosch wrote:
A couple of notes:
- I have not tested this. Likely there are some typos, and possibly even
a bit of forgotten syntax - hopefully it's easy to correct.
- Note that there's no need to re-wrap the methods that B inherits from
A, but you do have create both
I have a simple test case:
class Foo
{
public:
const int& getX() const {return x;}
void setX(const int& x_) {x = x_;}
private:
int x;
};
BOOST_PYTHON_MODULE(module)
{
class_("Foo")
.def("getX", &Foo::getX)
;
}
The problem is that I cannot wrap getX and I get a compile
Panos wrote:
I have a simple test case:
class Foo
{
public:
const int& getX() const {return x;}
void setX(const int& x_) {x = x_;}
private:
int x;
};
BOOST_PYTHON_MODULE(module)
{
class_("Foo")
.def("getX", &Foo::getX)
;
}
The problem is that I cannot wrap getX and
Hey and thanks for the answer! Unfortunately that doesn't seem to work. I'm
using boost.python for Python 3 ( boost python 1.44? )
error C2039: 'del' : is not a member of 'boost::python::api::object'
I've had a look on the reference manual but I don't understand if it's a
free function or an meth
I've only tried it with Python 2; I'm not setup for working with Python 3.
Try
boost::python::api::delitem(target, key);
and if that fails too
PyObject_DelItem(target.ptr(), key.ptr());
Ralf
>
>From: Simon W
>To: Development of Python/C++ integration
>Sent: Mon, October 25, 2010 8:48:2
Oh, at second glance...
> > object obj = mMainNamespace[ name.c_str() ];
> >obj.del();
This cannot work!
You need to do it the way I showed before.
mMainNamespace[ name.c_str() ].del();
The [] operator returns a proxy object which supports the del since
it still know
Thanks that did the trick!
On Mon, Oct 25, 2010 at 7:07 PM, Ralf W. Grosse-Kunstleve wrote:
> Oh, at second glance...
>
>
>
> > > object obj = mMainNamespace[ name.c_str() ];
> > >obj.del();
>
> This cannot work!
> You need to do it the way I showed before.
>
> mMainNames
Hey again,
I'm trying to implement a load / unload module functionallity. When I delete
the module in the __main__ dict the module's reference count is still > 1.
I've been trying to find if I reference it anywhere else in my code but I
can't find anything! When I did a check in vc++ debugger foun
Hi,
While I had some questions concerning accessing objects in Python, that
were previously created in C++ now I'd like to know whether it's
possible to get access to the raw memory from Python layer.
Let's suppose I have the char* ptr pointer that points to the memory
chunk with IPv4 packet. I
Does this works for you??
class Foo
{
public:
const int& getX() const {return x;}
void setX(const int& x_) {x = x_;}
private:
int x;
};
BOOST_PYTHON_MODULE(module)
{
class_("Foo")
.def("getX", &Foo::getX, return_value_policy())
;
}
With Regards,
Abhishek Srivastava
On 10/25/2010 10:51 AM, Marek Denis wrote:
Hi,
While I had some questions concerning accessing objects in Python, that
were previously created in C++ now I'd like to know whether it's
possible to get access to the raw memory from Python layer.
Let's suppose I have the char* ptr pointer that point
Panos, Erik,
the issue here is likely that Python's "int" objects are immutable.
Therefore, you can't pass around ints by reference, only by-value. If
the compiler is confused, perhaps you need to explicitly set a
return-value policy that makes this clear ?
Stefan
--
...ich hab'
12 matches
Mail list logo