[C++-sig] Re: to_python (by-value) converter

Simon Ouellet simon.ouellet at orthosoft.ca
Thu Sep 11 22:53:08 CEST 2003

to build boost on my linux station I compiled it with the following
command line

An error occured when I built the test embedding.cpp in

%bjam -d 2 embedding
...found 1959 targets...
...updating 4 targets...

    export LD_LIBRARY_PATH
    g++   -g  -o
"../../../libs/python/test/bin/embedding.test/gcc/debug/runtime-link-dynamic/embedding"  -L"/usr/local/lib/python2.2/config" -L"../../../libs/python/build/bin/libboost_python.so/gcc/debug/runtime-link-dynamic/shared-linkable-true"   "../../../libs/python/test/bin/embedding.test/gcc/debug/runtime-link-dynamic/embedding.o"     -lpython2.2 -ldl -lutil -lboost_python  -Wl,-rpath-link,.

/usr/local/lib/python2.2/config/libpython2.2.a(posixmodule.o): In
function `posix_tmpnam':
/usr/local/Python-2.2.1/./Modules/posixmodule.c:4501: the use of
`tmpnam_r' is dangerous, better use `mkstemp'
/usr/local/lib/python2.2/config/libpython2.2.a(posixmodule.o): In
function `posix_tempnam':
/usr/local/Python-2.2.1/./Modules/posixmodule.c:4451: the use of
`tempnam' is dangerous, better use `mkstemp'
/usr/local/lib/python2.2/config/libpython2.2.a(thread.o): In function
/usr/local/Python-2.2.1/Python/thread_pthread.h:180: undefined reference
to `pthread_sigmask'
/usr/local/Python-2.2.1/Python/thread_pthread.h:182: undefined reference
to `pthread_create'
/usr/local/Python-2.2.1/Python/thread_pthread.h:207: undefined reference
to `pthread_sigmask'
/usr/local/Python-2.2.1/Python/thread_pthread.h:216: undefined reference
to `pthread_detach'
collect2: ld returned 1 exit status

To built it I added -lpthread at the command line 
g++   -g  -o
"../../../libs/python/test/bin/embedding.test/gcc/debug/runtime-link-dynamic/embedding"  -L"/usr/local/lib/python2.2/config" -L"../../../libs/python/build/bin/libboost_python.so/gcc/debug/runtime-link-dynamic/shared-linkable-true"   "../../../libs/python/test/bin/embedding.test/gcc/debug/runtime-link-dynamic/embedding.o"     -lpython2.2 -ldl -lutil -lboost_python  -Wl,-rpath-link,. -lpthread

After that I make symbolic link of boost shared libraries in

My LD_LIBRARY_PATH contain /usr/local/lib of course.

And I start the test

I have no problem running the current version of embedding.cpp.
The output is
Hello from C++!
Hello from Python!

but the test doesn't cover the feature I'm currently looking for.

I modified the test to cover the conversion of a C++ object into a
python::object and it doesn't work.

I attached the diff that I made.

I built the the modified embedding.cpp the same way

When I ran it I got:

TypeError: No to_python (by-value) converter found for C++ type:


On Thu, 2003-09-11 at 15:24, David Abrahams wrote:
> Stefan Seefeld <stefan.seefeld at orthosoft.ca> writes:
> > Simon Ouellet wrote:
> >> On Thu, 2003-09-11 at 11:43, David Abrahams wrote:
> >
> >>>It works perfectly fine for me (with the current CVS state).  Are you
> >>>using Boost.Build or getting "creative" with your build?
> >>>
> >> I'm using g++3.2  on linux and  CC MIPSpro Version on IRIX.
> >> I'm using boost_30.2 and I got the error on both platforms.
> Let me be perfectly clear:
>     How are you doing the build?
>     How are you running the test?
> Please show command lines and Jamfiles.
> -- 
> Dave Abrahams
> Boost Consulting
> www.boost-consulting.com
> _______________________________________________
> C++-sig mailing list
> C++-sig at python.org
> http://mail.python.org/mailman/listinfo/c++-sig
Simon Ouellet		email: simon.ouellet at orthosoft.ca
Programmeur 		tel:   514-861-4074 #269
Orthosoft Inc.		fax:   514-866-2197

-------------- next part --------------
<     python::handle<> main_namespace(
<         python::borrowed(PyModule_GetDict(main_module.get())) );
>     python::object main_namespace = python::object(python::borrowed(
>                                                       PyModule_GetDict(main_module.get())));
>     CppDerived b;    
>     main_namespace["aBase"] = b;
<         Py_file_input, main_namespace.get(), main_namespace.get())
>         Py_file_input, main_namespace.ptr(), main_namespace.ptr())
<                      main_namespace.get(), main_namespace.get()) );
>                      main_namespace.ptr(), main_namespace.ptr()) );

More information about the Cplusplus-sig mailing list