Hello, I am taking a look at Boost.Python and I wonder if it is possible to convert pointers to existing classes to PyObjects* and then be able to pass an existing instance of an object directly to and from python: Example: In C++ I create a CWheel and I set its member m_diameter to 1233. In python I have a function that receives a CWheel and displays the diameter (Lets suppose that Python knows the CWheel from Boost.Python :-) ) Ex : def printCWheelDiam(awheel): print awheel.m_diameter What I would like to do Is to create the CWheel in C++, pass its pointer to python so it can manipulate it (and see that its diameter is 1233) and then return a CWheel that I could map from a PyObject to a CWheel in C++. In SWIG, it was easy to convert the pointers with the function : C++ to Python : MYSWIG_NewPointerObj Python to C++: MYSWIG_ConvertPtr Do you have an equivalent to these functions ? Or can you point me to documentation that explains how to do it ? Thanks again, Mathieu Tremblay mtremblay@golemlabs.com
I'm going to answer this in terms of Boost.Python v2, since v1 is now retired and won't be in the upcoming release. From: "Mathieu Tremblay" <mtremblay@golemlabs.com>
Hello, I am taking a look at Boost.Python and I wonder if it is possible to convert pointers to existing classes to PyObjects* and then be able to pass an existing instance of an object directly to and from python:
It is.
Example: In C++ I create a CWheel and I set its member m_diameter to 1233. In python I have a function that receives a CWheel and displays the diameter (Lets suppose that Python knows the CWheel from Boost.Python :-) ) Ex : def printCWheelDiam(awheel): print awheel.m_diameter
What I would like to do Is to create the CWheel in C++, pass its pointer to python so it can manipulate it (and see that its diameter is 1233) and then return a CWheel that I could map from a PyObject to a CWheel in C++.
The safest thing to do is to create the CWheel by invoking its class wrapper: // Declare the CWheel extension class object wheel_class = class_<CWheel>("CWheel") .def_readonly("m_diameter", &CWheel::m_diameter) .def("some_member_function", &CWheel::some_member_function) ... ; object wheel_obj = wheel_class(); // construct one Now you can pass wheel_obj back to python, and all reference counts are nicely managed. You don't need to "map" anything between C++ and Python; the library takes care of that for you. If you really want to pass pointers around, it's certainly possible to tell the library to build a Python object around the pointer, but then you need to make sure the lifetime of the C++ object being referenced by the pointer extends past the lifetime of all Python references to the object or your program will crash. ----------------------------------------------------------- David Abrahams * Boost Consulting dave@boost-consulting.com * http://www.boost-consulting.com
Hello, I have been reading the documentation on dealing with std::vector<> in Boost.Python, http://www.boost.org/libs/python/doc/cross_module.html, and this is exactly what I need for both vectors of built-in types and those using my own classes. I have used the class builder to expose such a vector as a Python object and now need to be able to go back and export some C++ functions that use them as arguments or as a return type. Is there a module already in Boost.Python that has "std_vector"? I cannot find anything on it and the html page above only supposes that one had such a module. I think it would help me out quite a bit if I could play with some vector<int> functions to try out what is suggested. Even more, if some of this is already in Boost.Python I would surely like to use it rather than begin doing so for all the class types I am using with std::vector. For example, I have this to expose my std::vector<std::string>: boost::python::class_builder<std::vector<std::string> > Vstring(PyModule, "Vstring"); Vstring.def(boost::python::constructor<>()); Vstring.def(Vstring_push_back, "push_back"); and this allows me to make objects of Vstring in Python just fine. The push_back stuff is done as shown in the comprehensive test. Now, how do I get VS = Vstring() VS = MyFunctionReturningStdVectorOfStrings() MyFunctionUsingStdVectorOfStrings(VS) by exporting C++ functions that are something like std::vector<std::string> MyFunctionReturningStdVectorOfStrings(); void MyFunctionUsingStdVectorOfStrings(std::vector<std::string>); to work in Python. Do I need import_converters/export_converters? Do I need them even when everything is in the same module? Neither the "vector_double" nor "string_map" in the comprehensive test show this and AFAIK the test does have any code where C++ functions using and returning std::vector<double> are exported and making use of vector_double. Is there other documentation on this, or perhaps a place where I can easily search for such info? Thanks, Scott ======================================= Dr. Scott A. Smith Associate in Research National High Magnetic Field Laboratory 1800 East Paul Dirac Drive Tallahassee, FL 32310 phone: (850) 644-6348 FAX: (850) 644-1366 email: ssmith@magnet.fsu.edu http://www.magnet.fsu.edu http://gamma.magnet.fsu.edu
-----Original Message----- From: c++-sig-admin@python.org [mailto:c++-sig-admin@python.org]On Behalf Of David Abrahams Sent: Wednesday, October 02, 2002 8:05 AM To: c++-sig@python.org Subject: Re: [C++-sig] Pointer manipulation Boost.Python - C++
I'm going to answer this in terms of Boost.Python v2, since v1 is now retired and won't be in the upcoming release.
From: "Mathieu Tremblay" <mtremblay@golemlabs.com>
Hello, I am taking a look at Boost.Python and I wonder if it is possible to convert pointers to existing classes to PyObjects* and then be able to pass an existing instance of an object directly to and from python:
It is.
Example: In C++ I create a CWheel and I set its member m_diameter to 1233. In python I have a function that receives a CWheel and displays the diameter (Lets suppose that Python knows the CWheel from Boost.Python :-) ) Ex : def printCWheelDiam(awheel): print awheel.m_diameter
What I would like to do Is to create the CWheel in C++, pass its pointer to python so it can manipulate it (and see that its diameter is 1233) and then return a CWheel that I could map from a PyObject to a CWheel in C++.
The safest thing to do is to create the CWheel by invoking its class wrapper:
// Declare the CWheel extension class object wheel_class = class_<CWheel>("CWheel") .def_readonly("m_diameter", &CWheel::m_diameter) .def("some_member_function", &CWheel::some_member_function) ... ;
object wheel_obj = wheel_class(); // construct one
Now you can pass wheel_obj back to python, and all reference counts are nicely managed. You don't need to "map" anything between C++ and Python; the library takes care of that for you.
If you really want to pass pointers around, it's certainly possible to tell the library to build a Python object around the pointer, but then you need to make sure the lifetime of the C++ object being referenced by the pointer extends past the lifetime of all Python references to the object or your program will crash.
----------------------------------------------------------- David Abrahams * Boost Consulting dave@boost-consulting.com * http://www.boost-consulting.com
_______________________________________________ C++-sig mailing list C++-sig@python.org http://mail.python.org/mailman/listinfo/c++-sig
Hi Scott, I think Ralf Grosse-Kunstleve is probably the one to answer your questions. He's the one who implemented the import/export stuff for Boost.Python v1, and has the most expertise in translating containers. He also has implemented a much better mechanism for Boost.Python v2. He's been travelling, but IIUC he might be able to get back to you by the end of the week. -Dave ----------------------------------------------------------- David Abrahams * Boost Consulting dave@boost-consulting.com * http://www.boost-consulting.com ----- Original Message ----- From: "Scott A. Smith" <ssmith@magnet.fsu.edu> To: <c++-sig@python.org> Sent: Wednesday, October 02, 2002 10:02 AM Subject: [C++-sig] std::vector
Hello,
I have been reading the documentation on dealing with std::vector<> in Boost.Python, http://www.boost.org/libs/python/doc/cross_module.html, and this is exactly what I need for both vectors of built-in types and those using my own classes. I have used the class builder to expose such a vector as a Python object and now need to be able to go back and export some C++ functions that use them as arguments or as a return type.
Is there a module already in Boost.Python that has "std_vector"? I cannot find anything on it and the html page above only supposes that one had such a module. I think it would help me out quite a bit if I could play with some vector<int> functions to try out what is suggested. Even more, if some of this is already in Boost.Python I would surely like to use it rather than begin doing so for all the class types I am using with std::vector.
For example, I have this to expose my std::vector<std::string>:
boost::python::class_builder<std::vector<std::string> > Vstring(PyModule, "Vstring"); Vstring.def(boost::python::constructor<>()); Vstring.def(Vstring_push_back, "push_back");
and this allows me to make objects of Vstring in Python just fine. The push_back stuff is done as shown in the comprehensive test. Now, how do I get
VS = Vstring() VS = MyFunctionReturningStdVectorOfStrings() MyFunctionUsingStdVectorOfStrings(VS)
by exporting C++ functions that are something like
std::vector<std::string> MyFunctionReturningStdVectorOfStrings(); void MyFunctionUsingStdVectorOfStrings(std::vector<std::string>);
to work in Python. Do I need import_converters/export_converters? Do I need them even when everything is in the same module? Neither the "vector_double" nor "string_map" in the comprehensive test show this and AFAIK the test does have any code where C++ functions using and returning std::vector<double> are exported and making use of vector_double.
Is there other documentation on this, or perhaps a place where I can easily search for such info?
Thanks, Scott
======================================= Dr. Scott A. Smith Associate in Research National High Magnetic Field Laboratory 1800 East Paul Dirac Drive Tallahassee, FL 32310
phone: (850) 644-6348 FAX: (850) 644-1366 email: ssmith@magnet.fsu.edu http://www.magnet.fsu.edu http://gamma.magnet.fsu.edu
-----Original Message----- From: c++-sig-admin@python.org [mailto:c++-sig-admin@python.org]On Behalf Of David Abrahams Sent: Wednesday, October 02, 2002 8:05 AM To: c++-sig@python.org Subject: Re: [C++-sig] Pointer manipulation Boost.Python - C++
I'm going to answer this in terms of Boost.Python v2, since v1 is now retired and won't be in the upcoming release.
From: "Mathieu Tremblay" <mtremblay@golemlabs.com>
Hello, I am taking a look at Boost.Python and I wonder if it is possible to convert pointers to existing classes to PyObjects* and then be able to pass an existing instance of an object directly to and from python:
It is.
Example: In C++ I create a CWheel and I set its member m_diameter to 1233. In python I have a function that receives a CWheel and displays the diameter (Lets suppose that Python knows the CWheel from Boost.Python :-) ) Ex : def printCWheelDiam(awheel): print awheel.m_diameter
What I would like to do Is to create the CWheel in C++, pass its pointer to python so it can manipulate it (and see that its diameter is 1233) and then return a CWheel that I could map from a PyObject to a CWheel in C++.
The safest thing to do is to create the CWheel by invoking its class wrapper:
// Declare the CWheel extension class object wheel_class = class_<CWheel>("CWheel") .def_readonly("m_diameter", &CWheel::m_diameter) .def("some_member_function", &CWheel::some_member_function) ... ;
object wheel_obj = wheel_class(); // construct one
Now you can pass wheel_obj back to python, and all reference counts are nicely managed. You don't need to "map" anything between C++ and Python; the library takes care of that for you.
If you really want to pass pointers around, it's certainly possible to tell the library to build a Python object around the pointer, but then you need to make sure the lifetime of the C++ object being referenced by the pointer extends past the lifetime of all Python references to the object or your program will crash.
----------------------------------------------------------- David Abrahams * Boost Consulting dave@boost-consulting.com * http://www.boost-consulting.com
_______________________________________________ C++-sig mailing list C++-sig@python.org http://mail.python.org/mailman/listinfo/c++-sig
_______________________________________________ C++-sig mailing list C++-sig@python.org http://mail.python.org/mailman/listinfo/c++-sig
--- David Abrahams <dave@boost-consulting.com> wrote:
Hi Scott,
I think Ralf Grosse-Kunstleve is probably the one to answer your questions. He's the one who implemented the import/export stuff for Boost.Python v1, and has the most expertise in translating containers. He also has implemented a much better mechanism for Boost.Python v2. He's been travelling, but IIUC he might be able to get back to you by the end of the week.
I could dig out some old stuff that I used with Boost.Python v1, but I highly recommend using Boost.Python v2. Is that a possibility? Ralf
----- Original Message ----- From: "Scott A. Smith" <ssmith@magnet.fsu.edu> To: <c++-sig@python.org> Sent: Wednesday, October 02, 2002 10:02 AM Subject: [C++-sig] std::vector
Hello,
I have been reading the documentation on dealing with std::vector<> in Boost.Python, http://www.boost.org/libs/python/doc/cross_module.html, and this is exactly what I need for both vectors of built-in types and those using my own classes. I have used the class builder to expose such a vector as a Python object and now need to be able to go back and export some C++ functions that use them as arguments or as a return type.
Is there a module already in Boost.Python that has "std_vector"? I cannot find anything on it and the html page above only supposes that one had such a module. I think it would help me out quite a bit if I could play with some vector<int> functions to try out what is suggested. Even more, if some of this is already in Boost.Python I would surely like to use it rather than begin doing so for all the class types I am using with std::vector.
For example, I have this to expose my std::vector<std::string>:
boost::python::class_builder<std::vector<std::string> > Vstring(PyModule, "Vstring"); Vstring.def(boost::python::constructor<>()); Vstring.def(Vstring_push_back, "push_back");
and this allows me to make objects of Vstring in Python just fine. The push_back stuff is done as shown in the comprehensive test. Now, how do I get
VS = Vstring() VS = MyFunctionReturningStdVectorOfStrings() MyFunctionUsingStdVectorOfStrings(VS)
by exporting C++ functions that are something like
std::vector<std::string> MyFunctionReturningStdVectorOfStrings(); void MyFunctionUsingStdVectorOfStrings(std::vector<std::string>);
to work in Python. Do I need import_converters/export_converters? Do I need them even when everything is in the same module? Neither the "vector_double" nor "string_map" in the comprehensive test show this and AFAIK the test does have any code where C++ functions using and returning std::vector<double> are exported and making use of vector_double.
Is there other documentation on this, or perhaps a place where I can easily search for such info?
Thanks, Scott
======================================= Dr. Scott A. Smith Associate in Research National High Magnetic Field Laboratory 1800 East Paul Dirac Drive Tallahassee, FL 32310
phone: (850) 644-6348 FAX: (850) 644-1366 email: ssmith@magnet.fsu.edu http://www.magnet.fsu.edu http://gamma.magnet.fsu.edu
-----Original Message----- From: c++-sig-admin@python.org [mailto:c++-sig-admin@python.org]On Behalf Of David Abrahams Sent: Wednesday, October 02, 2002 8:05 AM To: c++-sig@python.org Subject: Re: [C++-sig] Pointer manipulation Boost.Python - C++
I'm going to answer this in terms of Boost.Python v2, since v1 is now retired and won't be in the upcoming release.
From: "Mathieu Tremblay" <mtremblay@golemlabs.com>
Hello, I am taking a look at Boost.Python and I wonder if it is possible to convert pointers to existing classes to PyObjects* and then be able to pass an existing instance of an object directly to and from python:
It is.
Example: In C++ I create a CWheel and I set its member m_diameter to 1233. In python I have a function that receives a CWheel and displays the diameter (Lets suppose that Python knows the CWheel from Boost.Python :-) ) Ex : def printCWheelDiam(awheel): print awheel.m_diameter
What I would like to do Is to create the CWheel in C++, pass its pointer to python so it can manipulate it (and see that its diameter is 1233) and then return a CWheel that I could map from a PyObject to a CWheel in C++.
The safest thing to do is to create the CWheel by invoking its class wrapper:
// Declare the CWheel extension class object wheel_class = class_<CWheel>("CWheel") .def_readonly("m_diameter", &CWheel::m_diameter) .def("some_member_function", &CWheel::some_member_function) ... ;
object wheel_obj = wheel_class(); // construct one
Now you can pass wheel_obj back to python, and all reference counts are nicely managed. You don't need to "map" anything between C++ and Python; the library takes care of that for you.
If you really want to pass pointers around, it's certainly possible to tell the library to build a Python object around the pointer, but then you need to make sure the lifetime of the C++ object being referenced by the pointer extends past the lifetime of all Python references to the object or your program will crash.
----------------------------------------------------------- David Abrahams * Boost Consulting dave@boost-consulting.com * http://www.boost-consulting.com
_______________________________________________ C++-sig mailing list C++-sig@python.org http://mail.python.org/mailman/listinfo/c++-sig
_______________________________________________ C++-sig mailing list C++-sig@python.org http://mail.python.org/mailman/listinfo/c++-sig
_______________________________________________ C++-sig mailing list C++-sig@python.org http://mail.python.org/mailman/listinfo/c++-sig
__________________________________________________ Do you Yahoo!? New DSL Internet Access from SBC & Yahoo! http://sbc.yahoo.com
Hi Ralf,
I could dig out some old stuff that I used with Boost.Python v1, but I highly recommend using Boost.Python v2. Is that a possibility?
Quite frankly, I don't know. It is not clear to me how one uses/builds version 2 versus version 1 yet. I there a way to see what version the Boost.Python library is? I am pretty sure that at the moment I am using 1.28, but I did build the cvs version few months back. At that time I remember I was confused over which version I was actually building. Didn't it depend upon what directory jam was invoked from or something like that? I'll look over the old messages to see if I can make sense out of things, and try to build/switch to v2. Hopefully it will be compatible with what I have done so far. I guess I need to update my Boost stuff from CVS? Then (since I only need Boost.Python at the moment), does it still matter what directory I start the build from? It would be great if I can get vectors, lists, etc. working smoothly. Your (& Dave's) help is and has been much appreciated. Scott
I have been reading the documentation on dealing with std::vector<> in Boost.Python, http://www.boost.org/libs/python/doc/cross_module.html, and this is exactly what I need for both vectors of built-in types and those using my own classes. I have used the class builder to expose such a vector as a Python object and now need to be able to go back and export some C++ functions that use them as arguments or as a return type.
Is there a module already in Boost.Python that has "std_vector"? I cannot find anything on it and the html page above only supposes that one had such a module. I think it would help me out quite a bit if I could play with some vector<int> functions to try out what is suggested. Even more, if some of this is already in Boost.Python I would surely like to use it rather than begin doing so for all the class types I am using with std::vector.
For example, I have this to expose my std::vector<std::string>:
boost::python::class_builder<std::vector<std::string> > Vstring(PyModule, "Vstring"); Vstring.def(boost::python::constructor<>()); Vstring.def(Vstring_push_back, "push_back");
and this allows me to make objects of Vstring in Python just fine. The push_back stuff is done as shown in the comprehensive test. Now, how do I get
VS = Vstring() VS = MyFunctionReturningStdVectorOfStrings() MyFunctionUsingStdVectorOfStrings(VS)
by exporting C++ functions that are something like
std::vector<std::string> MyFunctionReturningStdVectorOfStrings(); void MyFunctionUsingStdVectorOfStrings(std::vector<std::string>);
to work in Python. Do I need import_converters/export_converters? Do I need them even when everything is in the same module? Neither the "vector_double" nor "string_map" in the comprehensive test show this and AFAIK the test does have any code where C++ functions using and returning std::vector<double> are exported and making use of vector_double.
Is there other documentation on this, or perhaps a place where I can easily search for such info?
--- "Scott A. Smith" <ssmith@magnet.fsu.edu> wrote:
At that time I remember I was confused over which version I was actually building. Didn't it depend upon what directory jam was invoked from or something like that?
Right. You have to start bjam in libs/python/test to get the V2 build.
I'll look over the old messages to see if I can make sense out of things, and try to build/switch to v2. Hopefully it will be compatible with what I have done so far.
V2 is awesome. In comparison V1 seems like a prototype. Since V2 is so much improved you will have to rework your Boost.Python code.
I guess I need to update my Boost stuff from CVS? Then (since I only need Boost.Python at the moment), does it still matter what directory I start the build from?
I believe so. Unfortunately the main CVS is broken right now because of some recent changes in the random number library. I will try the release candidate branch to see if that works ...
It would be great if I can get vectors, lists, etc. working smoothly. Your (& Dave's) help is and has been much appreciated.
I am sure the Boost.Python V2 facilities will help you achieving this goal. I am planning to write a little summary of the choices that you have. But first we have to get the CVS going again. Ralf __________________________________________________ Do you Yahoo!? New DSL Internet Access from SBC & Yahoo! http://sbc.yahoo.com
From: "Ralf W. Grosse-Kunstleve" <rwgk@yahoo.com>
--- "Scott A. Smith" <ssmith@magnet.fsu.edu> wrote:
At that time I remember I was confused over which version I was actually building. Didn't it depend upon what directory jam was invoked from or something like that?
Right. You have to start bjam in libs/python/test to get the V2 build.
Well, you can do it in libs/python if all you want is the library and none of the tests.
I am sure the Boost.Python V2 facilities will help you achieving this goal. I am planning to write a little summary of the choices that you have. But first we have to get the CVS going again.
Before Jens gets to fixing the actual Boost.Random problems, Jeremy's going to break the dependency between boost::graph::adjacency_list and Boost.Random so that our errors disappear. I'm pretty sure the release candidate branch will work in the meantime. Or, you can get boost as I tagged it for my LLNL deliverable: cd $BOOST_ROOT cvs update -rboost_python_llnl_ . Which I know to be a working version. -Dave ----------------------------------------------------------- David Abrahams * Boost Consulting dave@boost-consulting.com * http://www.boost-consulting.com
--- "Ralf W. Grosse-Kunstleve" <rwgk@yahoo.com> wrote:
--- "Scott A. Smith" <ssmith@magnet.fsu.edu> wrote:
It would be great if I can get vectors, lists, etc. working smoothly. Your (& Dave's) help is and has been much appreciated.
I am sure the Boost.Python V2 facilities will help you achieving this goal. I am planning to write a little summary of the choices that you have. But first we have to get the CVS going again.
I have verified that the RC_1_29_0 branch of boost is working properly. Attached is the little summary that I promised earlier. Feedback is most welcome. Ralf Notes on container conversions in Boost.Python V2: 1. Using the regular class_<> wrapper: class_<std::vector<double> >("std_vector_double") .def(...) ... ; This can be moved to a template so that several types (double, int, long, etc.) can be wrapped with the same code. This technique is used in the file scitbx/include/scitbx/array_family/boost_python/flex_wrapper.h in the "scitbx" package. The file could easily be modified for wrapping std::vector<> instantiations. This type of C++/Python binding is most suitable for containers that may contain a large number of elements (>10000). 2. Using custom rvalue converters. Boost.Python "rvalue converters" match function signatures such as: void foo(std::vector<double> const& array); // pass by const-reference void foo(std::vector<double> array); // pass by value Some custom rvalue converters are implemented in the file scitbx/include/scitbx/boost_python/container_conversions.h This code can be used to convert from C++ container types such as std::vector<> or std::list<> to Python tuples and vice versa. A few simple examples can be found in the file scitbx/array_family/boost_python/regression_test_module.cpp Automatic C++ container <-> Python tuple conversions are most suitable for containers of moderate size. These converters generate significantly less object code compared to alternative 1 above. A disadvantage of using alternative 2 is that operators such as arithmetic +,-,*,/,% are not available. It would be useful to have custom rvalue converters that convert to a "math_array" type instead of tuples. This is currently not implemented but is possible within the framework of Boost.Python V2 as it will be released in the next couple of weeks. It would also be useful to also have "custom lvalue converters" such as std::vector<> <-> Python list. These converters would support the modification of the Python list from C++. For example: C++: void foo(std::vector<double>& array) { for(std::size_t i=0;i<array.size();i++) { array[i] *= 2; } } Python:
l = [1, 2, 3] foo(l) print l [2, 4, 6]
Custom lvalue converters require changes to the Boost.Python core library and are currently not available. P.S.: The "scitbx" files referenced above are available via anonymous CVS: cvs -d:pserver:anonymous@cvs.cctbx.sourceforge.net:/cvsroot/cctbx login cvs -d:pserver:anonymous@cvs.cctbx.sourceforge.net:/cvsroot/cctbx co scitbx __________________________________________________ Do you Yahoo!? New DSL Internet Access from SBC & Yahoo! http://sbc.yahoo.com
----- Original Message ----- From: "Ralf W. Grosse-Kunstleve" <rwgk@yahoo.com>
Attached is the little summary that I promised earlier. Feedback is most welcome.
Ralf, I just added this to the v2 FAQ. If you get inspired to expand it based on feedback, please do so in the CVS. Thanks, Dave ----------------------------------------------------------- David Abrahams * Boost Consulting dave@boost-consulting.com * http://www.boost-consulting.com
Hi Ralf, I just made my intial attempts to look at the std::vector stuff you sent. Unfortunately, I am stuck at the beginning, checking out a specific (or any) branch. I am not too good at CVS apparently.
I have verified that the RC_1_29_0 branch of boost is working properly.
I would be glad to try and get/build both 1.29.0 and 2.0. After looking over the last 4 months of these messages, at Source Forge, and at Yahoo I still don't know the simple means to do this. I know enough to do the following: cvs -d:pserver:anonymous@cvs.boost.sourceforge.net:/cvsroot/boost login cvs -z3 -d:pserver:anonymous@cvs.boost.sourceforge.net:/cvsroot/boost checkout boost ... a couple more commands cvs -d:pserver:anonymous@cvs.boost.sourceforge.net:/cvsroot/boost logout At least I was able to obtain scitbx! But what are the commands to get only RC_1_29_0 or 2.0 or develop? Do you (locally) keep these in different directories? What does RC stand for? Is is better or just as easy to just copy things from a browser from Source Forge? I'll give vectors & lists a go today if I can get a version of Boost.Python that can handle the stuff you wrote about earlier. Thanks, Scott
--- "Scott A. Smith" <ssmith@magnet.fsu.edu> wrote:
I would be glad to try and get/build both 1.29.0 and 2.0. After looking over the last 4 months of these messages, at Source Forge, and at Yahoo I still don't know the simple means to do this. But what are the commands to get only RC_1_29_0 or 2.0 or develop? What does RC stand for?
RC_1_29_0 stands for "Release Candidate for 1.29.0" . Boost.Python Version 2 is part of boost 1.29.0 . Our use of "V2" does not correspond to a package V2, it is just a subset of the upcoming boost 1.29.0 release.
Do you (locally) keep these in different directories?
I have indeed one "CVS working copy" of the CVS trunk, and another copy of the RC_1_29_0 branch. For people who do not wish to endure the pains of being at the forefront of the development, right now working with the RC_1_29_0 branch might be the best approach.
Is is better or just as easy to just copy things from a browser from Source Forge?
I don't think so. Can you check out entire directory hierarchies through the browser? To check out the release candidate branch: cvs -d:pserver:anonymous@cvs.boost.sourceforge.net:/cvsroot/boost co -r RC_1_29_0 boost
I'll give vectors & lists a go today if I can get a version of Boost.Python that can handle the stuff you wrote about earlier.
Right now both the main trunk and the RC branch appear to be in perfect shape for Boost.Python compilation. But I'd recommend using the branch, and then the next release as soon as it becomes available. Ralf __________________________________________________ Do you Yahoo!? New DSL Internet Access from SBC & Yahoo! http://sbc.yahoo.com
Hi Ralf,
(RK) Boost.Python Version 2 is part of boost 1.29.0 . Our use of "V2" does not correspond to a package V2, it is just a subset of the upcoming boost 1.29.0 release.
(RK) You have to start bjam in libs/python/test to get the V2 build.
(DA) Well, you can do it in libs/python if all you want is the library and none of the tests.
Right, David had already told me about the versioning but I forgot. I downloaded the RC_1_29_0 branch and it compiled fine from libs/python to produce a bpl.dll. I think David also told me that name alone (vs. boost_python.dll) indicates V2? I assume compiling from libs/python/test would do the same (but also compile the test sources therein). I guess it will be a while before I get to try out std::vector because none of my currently used BP headers are working with V2 (e.g. boost/python/reference.hpp, boost/python/class_builder.hpp). Since they seem to be completely gone & I cannot find any documentation about which are used when, I guess that leaves going through the codes in libs/python/test to determine how things work? Probably a good idea in general anyway. Not that I am complaining, I know this is in flux. But is that what I should be doing or is there some other means available for finding such things out, akin to the examples stemming off of the current Boost.Python WWW page perhaps? After a glance through some files in /test it looks as things are now radically different & I have a lot of work ahead of me just to switch to V2...... Thanks, Scott
From: "Scott A. Smith" <ssmith@magnet.fsu.edu>
Right, David had already told me about the versioning but I forgot. I downloaded the RC_1_29_0 branch and it compiled fine from libs/python to produce a bpl.dll. I think David also told me that name alone (vs. boost_python.dll) indicates V2? I assume compiling from libs/python/test would do the same (but also compile the test sources therein).
It's now impossible to be confused about which version you're using because v1 is no longer in the CVS repository, neither on the main trunk nor on the RC_1_29_0 branch.
I guess it will be a while before I get to try out std::vector because none of my currently used BP headers are working with V2 (e.g. boost/python/reference.hpp, boost/python/class_builder.hpp). Since they seem to be completely gone
Those were v1 interfaces, which are now dead.
& I cannot find any documentation about which are used when,
There is fairly complete and up-to-date reference documentation in libs/python/doc/v2/reference.html (also http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/*checkout*/boost/boost/libs/ python/doc/v2/index.html?rev=HEAD&content-type=text/html)
I guess that leaves going through the codes in libs/python/test to determine how things work? Probably a good idea in general anyway.
Probably.
Not that I am complaining, I know this is in flux. But is that what I should be doing
Reading the docs and looking at the examples it contains, as well as the tests in libs/python/test/*.cpp, is a good approach.
or is there some other means available for finding such things out, akin to the examples stemming off of the current Boost.Python WWW page perhaps?
There are also v2 examples in libs/python/example now.
After a glance through some files in /test it looks as things are now radically different & I have a lot of work ahead of me just to switch to V2......
Yes, things are radically different. The new library is a complete rewrite with a new interface. You should find it much easier to use, but it is going to require some adjustments. ----------------------------------------------------------- David Abrahams * Boost Consulting dave@boost-consulting.com * http://www.boost-consulting.com
participants (4)
-
David Abrahams -
Mathieu Tremblay -
Ralf W. Grosse-Kunstleve -
Scott A. Smith