Re: [C++-sig] CMake and getting starting with boost.python
Dear Braddock, I'm trying to build Python wrappers with Boost for a fairly large C++ project - and most of its configuration is in CMake. Do you have any more information on using Boost Python through cmake. Specifically - i'm interested in configuring cmake to auto-detect (or atleast require) the boost installation and necessary libraries. thanks, -fj -- View this message in context: http://boost.2283326.n4.nabble.com/C-sig-CMake-and-getting-starting-with-boost-python-tp2700144p3722133.html Sent from the Python - c++-sig mailing list archive at Nabble.com. ___ Cplusplus-sig mailing list [email protected] http://mail.python.org/mailman/listinfo/cplusplus-sig
Re: [C++-sig] How to import a boost::python dll in windows?
Hi, I am having a similar problem as the o.p. I was trying to build Python wrappers for the hello_ext project given in the boost tutorial using CMake instead of bjam using the instructions as per http://mail.python.org/pipermail/cplusplus-sig/2007-June/012247.html The setup is Boost 1.47.0, Python 2.7, Windows 7 x64, MSVC 2008 (9.0) x64. After doing CMake and MSVC - it produces a hello_ext.dll. Even if i rename this to hello_ext.pyd, Python throws the following error. Any suggestions / ideas ? Thanks, -fj In [12]: ls Directory of D:\software\boost\boost-source\libs\python\example\tutorial\build\Release 05-Aug-11 16:36 . 05-Aug-11 16:36 .. 05-Aug-11 16:34 732 hello_ext.exp 05-Aug-11 16:34 945,152 hello_ext.idb 05-Aug-11 16:34 1,750 hello_ext.lib 05-Aug-11 16:3411,264 hello_ext.pyd 4 File(s)958,898 bytes 2 Dir(s) 370,089,795,584 bytes free In [13]: import hello_ext --- ImportError Traceback (most recent call last) D:\software\boost\boost-source\libs\python\example\tutorial\build\Release\ in () > 1 import hello_ext ImportError: DLL load failed: The specified module could not be found. -- View this message in context: http://boost.2283326.n4.nabble.com/C-sig-How-to-import-a-boost-python-dll-in-windows-tp2699467p3722232.html Sent from the Python - c++-sig mailing list archive at Nabble.com. ___ Cplusplus-sig mailing list [email protected] http://mail.python.org/mailman/listinfo/cplusplus-sig
Re: [C++-sig] How to import a boost::python dll in windows?
Hi, The problem was with using the dynamic version of the windows libraries (/MD) - after changing the project settings to use the static libraries (/MT) this worked out just fine. thanks, -firdaus From: Jim Bosch-2 [via Boost] To: fjanoos Sent: Friday, August 5, 2011 5:35 PM Subject: Re: How to import a boost::python dll in windows? I know next-to-nothing about linking dynamic libraries in Windows, but if I saw a message like that in Linux, I'd check my dynamic linker path to ensure the Boost.Python shared library is in it; any Python module you build is linked against against that library. If the dynamic linker can't find the boost_python library when it tries to load your module, it's very likely that it would complain about your module not being found, because it was unable to resolve some symbols in it. Hopefully a Windows expert on the list will chime in, but I gather the list is rather short on those. HTH Jim Bosch On 08/05/2011 01:43 PM, fjanoos wrote: > Hi, > I am having a similar problem as the o.p. > > I was trying to build Python wrappers for the hello_ext project given in the > boost tutorial using CMake instead of bjam using the instructions as per > http://mail.python.org/pipermail/cplusplus-sig/2007-June/012247.html > > The setup is Boost 1.47.0, Python 2.7, Windows 7 x64, MSVC 2008 (9.0) x64. > > After doing CMake and MSVC - it produces a hello_ext.dll. Even if i rename > this to hello_ext.pyd, Python throws the following error. Any suggestions / > ideas ? > > Thanks, > -fj > > In [12]: ls > > Directory of > D:\software\boost\boost-source\libs\python\example\tutorial\build\Release > > 05-Aug-11 16:36 . > 05-Aug-11 16:36 .. > 05-Aug-11 16:34 732 hello_ext.exp > 05-Aug-11 16:34 945,152 hello_ext.idb > 05-Aug-11 16:34 1,750 hello_ext.lib > 05-Aug-11 16:34 11,264 hello_ext.pyd > 4 File(s) 958,898 bytes > 2 Dir(s) 370,089,795,584 bytes free > > In [13]: import hello_ext > --- > ImportError Traceback (most recent call last) > D:\software\boost\boost-source\libs\python\example\tutorial\build\Release\ > 8768> in() > > 1 import hello_ext > > ImportError: DLL load failed: The specified module could not be found. > > > > -- > View this message in context: > http://boost.2283326.n4.nabble.com/C-sig-How-to-import-a-boost-python-dll-in-windows-tp2699467p3722232.html > Sent from the Python - c++-sig mailing list archive at Nabble.com. > ___ > Cplusplus-sig mailing list > [hidden email] > http://mail.python.org/mailman/listinfo/cplusplus-sig ___ Cplusplus-sig mailing list [hidden email] http://mail.python.org/mailman/listinfo/cplusplus-sig If you reply to this email, your message will be added to the discussion below:http://boost.2283326.n4.nabble.com/C-sig-How-to-import-a-boost-python-dll-in-windows-tp2699467p3722336.html To unsubscribe from [C++-sig]How to import a boost::python dll in windows?, click here. -- View this message in context: http://boost.2283326.n4.nabble.com/C-sig-How-to-import-a-boost-python-dll-in-windows-tp2699467p3722373.html Sent from the Python - c++-sig mailing list archive at Nabble.com.___ Cplusplus-sig mailing list [email protected] http://mail.python.org/mailman/listinfo/cplusplus-sig
[C++-sig] Wrapping std::vector with boost::python::list
Hello,
I'm new to boost::python and was having trouble wrapping a C++ function of
the form
void FindVCs(int vId, vector& vcs);
Here vcs is allocated in the caller and populated by FindVCs.
Initially, I considered wrapping it something like this:
boost::python::list* FindVCs_wrap(int vid)
{
vector vcs;
FindVCs(vid,vcs);
//wrap and return
boost::python::list* out_list = new boost::python::list;
unsigned int num_elems = vcs.size();
for( unsigned int idx = 0; idx < num_elems; idx++){
out_list->append(vcs[idx]);
}
return out_list;
}
however, this gives me compile time errors
Error 5 error C2027: use of undefined type
'boost::python::detail::specify_a_return_value_policy_to_wrap_functions_returning'
Then I change the return type to
boost::shared_ptr FindVCs_wrap(int vid)
{
...
return boost::shared_ptr(out_list);
}
This compiles fine but then at runtime Python raises:
TypeError: No to_python (by-value) converter found for C++ type: class
boost::shared_ptr
Any ideas of what I am doing wrong ? Also, it is possible to instantiate and
directly return a std::vector object from Python without going through
the boost::python::list object ?
I've been googling this for 2 days and I can't seem to find any relevant
information. Any pointers would be appreciated.
thanks,
-fj
--
View this message in context:
http://boost.2283326.n4.nabble.com/Wrapping-std-vector-int-with-boost-python-list-tp3731281p3731281.html
Sent from the Python - c++-sig mailing list archive at Nabble.com.
___
Cplusplus-sig mailing list
[email protected]
http://mail.python.org/mailman/listinfo/cplusplus-sig
[C++-sig] Wrapping std::vector with boost::python::list
Hello,
I'm new to boost::python and was having trouble wrapping a C++ function of
the form
void FindVCs(int vId, vector& vcs);
Here vcs is allocated in the caller and populated by FindVCs.
Initially, I considered wrapping it something like this:
boost::python::list* FindVCs_wrap(int vid)
{
vector vcs;
FindVCs(vid,vcs);
//wrap and return
boost::python::list* out_list = new boost::python::list;
unsigned int num_elems = vcs.size();
for( unsigned int idx = 0; idx < num_elems; idx++){
out_list->append(vcs[idx]);
}
return out_list;
}
however, this gives me compile time errors
Error 5 error C2027: use of undefined type
'boost::python::detail::specify_a_return_value_policy_to_wrap_functions_returning'
Then I change the return type to
boost::shared_ptr FindVCs_wrap(int vid)
{
...
return boost::shared_ptr(out_list);
}
This compiles fine but then at runtime Python raises:
TypeError: No to_python (by-value) converter found for C++ type: class
boost::shared_ptr
Any ideas of what I am doing wrong ?
thanks,
-fj
--
View this message in context:
http://boost.2283326.n4.nabble.com/Wrapping-std-vector-int-with-boost-python-list-tp3731291p3731291.html
Sent from the Python - c++-sig mailing list archive at Nabble.com.
___
Cplusplus-sig mailing list
[email protected]
http://mail.python.org/mailman/listinfo/cplusplus-sig
