[C++-sig] Re: Re: Re: how to access live c++ object?

??[?????] yangbing at kingsoft.com
Fri Mar 18 06:09:55 CET 2005


The problem has been solved ,  thanks....


"Leonard "paniq" Ritter" <paniq at paniq.org> wrote in message
news:42395C58.1050202 at paniq.org...
i dont understand you at all.

have you read
http://www.boost.org/libs/python/doc/tutorial/doc/html/index.html

and especially
http://www.boost.org/libs/python/doc/tutorial/doc/html/python/functions.html#python.call_policies

Ñî±ù[Ô´´úÂëÖ®¹â] wrote:

>If the c++ object is pointer, How do I write def function?
>def("getCT",getCT,return_value_policy<reference_existing_object>());
>
>I think reference_existing_object may be changed, is right?
>
>"Leonard "paniq" Ritter" <paniq at paniq.org> wrote in message
>news:4238302A.5040205 at paniq.org...
>if getCT had really failed, you would have get an exception when calling
>SetNum. try repr(a), and if the return type is None, SetNum is most
>probably of return type void.
>
>??[?????] wrote:
>
>
>
>>this is python code
>>def run():
>>myFoo = HoHo_PI.getCT()
>>a = myFoo.SetNum( 50 )
>>b=str(a)
>>
>>But b is none? why? thx
>>
>>
>>"Leonard "paniq" Ritter" <paniq at paniq.org> wrote in message
>>news:42354F3F.5070406 at paniq.org...
>>...
>>
>>def("getCT",&getCT,return_value_policy<reference_existing_object>());
>>
>>...
>>
>>Ñî±ù[Ô´´úÂëÖ®¹â] wrote:
>>
>>
>>
>>
>>
>>>This is my class
>>>class CT
>>>{
>>>public:
>>>CT() {};
>>>~CT() {};
>>>int GetNum( void )   { return num; }
>>>void SetNum( int n )  { num = n; }
>>>
>>>private:
>>>int num;
>>>};
>>>
>>>static CT ct;
>>>
>>>CT & getCT( void )
>>>{
>>>return ct;
>>>}
>>>
>>>I want to access ct object from boost.python, thanks for your advice.
>>>
>>>
>>>
>>>_______________________________________________
>>>C++-sig mailing list
>>>C++-sig at python.org
>>>http://mail.python.org/mailman/listinfo/c++-sig
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>
>>_______________________________________________
>>C++-sig mailing list
>>C++-sig at python.org
>>http://mail.python.org/mailman/listinfo/c++-sig
>>
>>
>>
>>
>>
>>
>
>
>
>
>_______________________________________________
>C++-sig mailing list
>C++-sig at python.org
>http://mail.python.org/mailman/listinfo/c++-sig
>
>
>
>






More information about the Cplusplus-sig mailing list