[C++-sig] How to import a boost::python dll in windows?

Jim Bosch talljimbo at gmail.com
Fri Aug 5 23:24:29 CEST 2011


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<DIR>           .
> 05-Aug-11  16:36<DIR>           ..
> 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\<ipython-input-13-18c4d654
> 8768>  in<module>()
> ---->  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
> Cplusplus-sig at python.org
> http://mail.python.org/mailman/listinfo/cplusplus-sig



More information about the Cplusplus-sig mailing list