Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r50037 - sandbox/compile-in-place
From: doomster_at_[hidden]
Date: 2008-11-30 13:22:40


Author: eckhardt
Date: 2008-11-30 13:22:40 EST (Sun, 30 Nov 2008)
New Revision: 50037
URL: http://svn.boost.org/trac/boost/changeset/50037

Log:
- Rename module to test_python_extend and document that the name is actually
important.
- Some more documentation updates.

Text files modified:
   sandbox/compile-in-place/test-python-extend.cpp | 18 +++++++++++-------
   1 files changed, 11 insertions(+), 7 deletions(-)

Modified: sandbox/compile-in-place/test-python-extend.cpp
==============================================================================
--- sandbox/compile-in-place/test-python-extend.cpp (original)
+++ sandbox/compile-in-place/test-python-extend.cpp 2008-11-30 13:22:40 EST (Sun, 30 Nov 2008)
@@ -1,17 +1,21 @@
 /* example to demonstrate compile-in-place for extending Python
 
 Compile with
- $CXX -I path/to/boost_X_YY_Z -I path/to/python-includes test-python-extend.cpp -shared -o hello.so
+ $CXX -I path/to/boost_X_YY_Z -I path/to/python-includes test-python-extend.cpp -shared -o test_python_extend.so
 
 Notes:
 
-- This must be compiled into a shared object (hello.so) or DLL (hello.dll) so
-that you can load it from Python. The exact syntax for that probably differs
-from above commandline.
+- This must be compiled into a shared object (*.so) or DLL (*.dll) so that you
+can load it from Python. The exact syntax for that probably differs from above
+commandline. Note: Python 2.5 deprecates the use of *.dll for modules in favor
+of *.pyd and Python 2.6 removes support for *.dll entirely. I'm not sure if a
+similar problem exists under POSIX platforms, too.
 
 - To load it, simply open an interactive interpreter in the same dir as the
-compiled module and "import hello". You can then call the exported function
-using "hello.greet()".
+compiled module and "import test_python_extend". You can then call the exported
+function using "test_python_extend.greet()". Note that the name used below in
+the macro BOOST_PYTHON_MODULE must be the same as the filename of the module
+without the extension, otherwise Python can't load it!
 
 - Compiling with g++ -Wall will give you lots of warnings that a string
 literal is converted to a non-const pointer because the Python functions are
@@ -32,7 +36,7 @@
     return "hello, world";
 }
 
-BOOST_PYTHON_MODULE(hello)
+BOOST_PYTHON_MODULE(test_python_extend)
 {
     def("greet", greet);
 }


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk