[C++-sig] Can boost python do these 2 things automatically?
Chang Chen
Chang_Chen at sonic.com
Thu Oct 11 10:58:30 CEST 2007
Hi All
I am new to boost python. I have 2 questions for using boost python to wrap C++ API
Our C++ API looks like this:
class BImpl;
Class B
{
public:
B(){}
Error DoSomething();
private:
BImpl*; mpBImpl
}
class A
{
public:
A(){}
Error CreateB(B& bObj);
private:
...
}
Our error handle strategy is returning an error code other than throwing exception. This is because throwing an exception across the DLL boundary is not safe.
I want to wrap A and B with same C++ public interface in python, but
#1 I want to return real object rather than retrieve object. i.e. in python, I would like users writing code like this:
aObject = A()
~bObject = aObject.CreateB()~
#2 I want to throw an *python* exception rather than return an error code like c++.
I do not know how to do it in Boost Python.
Any suggestion?
Chang
More information about the Cplusplus-sig
mailing list