List Info

Thread: Re: Can boost python do these 2 things automatically?




Re: Can boost python do these 2 things automatically?
user name
2007-10-11 03:58:30
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
_______________________________________________
C++-sig mailing list
C++-sigpython.org
http:
//mail.python.org/mailman/listinfo/c++-sig

[1]

about | contact  Other archives ( Real Estate discussion Medical topics )