Re: [C++-sig] a boost.python question about parameter that is a pointer of instance.

2012-11-17 Thread simon zhang
thanks.I completed it...this is orther problem.The above code is correct.Thanks for you... 2012/11/18 Holger Brandsmeier > That error has nothing to do with boost python. Apparently you did not > link against the definition for the class Rectangle. You need to link > against the object file

Re: [C++-sig] a boost.python question about parameter that is a pointer of instance.

2012-11-17 Thread simon zhang
http://stackoverflow.com/questions/4331599/calling-python-functions-from-c This a simple problem.But they are not the same.My problem is: boost::python::object func; Rectangle ret; func(&ret); // How to make a parameter of c++ instance's pointer to a python function. 2012/11/18 Holger Brands

Re: [C++-sig] a boost.python question about parameter that is a pointer of instance.

2012-11-17 Thread Holger Brandsmeier
That error has nothing to do with boost python. Apparently you did not link against the definition for the class Rectangle. You need to link against the object file generated from the definiton of Rectangle, usually you would have a Rectangle.cpp and generate a Rectangle.o. Your python module needs

Re: [C++-sig] a boost.python question about parameter that is a pointer of instance.

2012-11-17 Thread simon zhang
I have write more code.what documentation? http://www.boost.org/? Looks some confused.I have not found the description of this problem. BOOST_PYTHON_MODULE(ctopython) { using namespace boost::python; class_ ("Rectangle") .def("area",&Rectangle::area) ; def("runtest",runtes

Re: [C++-sig] a boost.python question about parameter that is a pointer of instance.

2012-11-17 Thread simon zhang
yes..I try it.. Error:undefined symbol:_ZRI9Rectangle 2012/11/17 Sybren A. Stüvel > > On 17 November 2012 16:46, simon zhang wrote: > >> > func( &rt ); >> How to make a parameter of c++ instance's pointer to a python function. >> >> > def pfunc( ret ) >> > print ret.long >> > print ret.

Re: [C++-sig] a boost.python question about parameter that is a pointer of instance.

2012-11-17 Thread Holger Brandsmeier
Have a look at http://stackoverflow.com/questions/4331599/calling-python-functions-from-c On Sat, Nov 17, 2012 at 4:25 PM, simon zhang wrote: > This is a complex problem. I provide some code. > > c++ > === > #include > #include > #include > > class Rectangle

Re: [C++-sig] a boost.python question about parameter that is a pointer of instance.

2012-11-17 Thread Sybren A . Stüvel
On 17 November 2012 16:46, simon zhang wrote: > > func( &rt ); > How to make a parameter of c++ instance's pointer to a python function. > > > def pfunc( ret ) > > print ret.long > > print ret.area() > How to use c++ instance in python code. > parameter > Have you tried what you coded a

Re: [C++-sig] a boost.python question about parameter that is a pointer of instance.

2012-11-17 Thread simon zhang
> func( &rt ); How to make a parameter of c++ instance's pointer to a python function. > def pfunc( ret ) > print ret.long > print ret.area() How to use c++ instance in python code. parameter 2012/11/17 Sybren A. Stüvel > On 17 November 2012 16:25, simon zhang wrote: > >> how to do? >>

Re: [C++-sig] a boost.python question about parameter that is a pointer of instance.

2012-11-17 Thread Sybren A . Stüvel
On 17 November 2012 16:25, simon zhang wrote: > how to do? > So... what's your question exactly? -- Sybren A. Stüvel http://stuvel.eu/ ___ Cplusplus-sig mailing list Cplusplus-sig@python.org http://mail.python.org/mailman/listinfo/cplusplus-sig

[C++-sig] a boost.python question about parameter that is a pointer of instance.

2012-11-17 Thread simon zhang
This is a complex problem. I provide some code. c++ === #include #include #include class Rectangle { public: Rectangle(); virtual ~Rectangle(); void set(int lg,int wd) { long=lg; width=wd; }; int area() { return long*width; } ; int long;