diff --git a/Jamfile b/Jamfile index a664d891e..32a51cd18 100755 --- a/Jamfile +++ b/Jamfile @@ -161,6 +161,15 @@ rule linking ( properties * ) { if static in $(properties) { + if shared in $(properties) + { + # if libtorrent is being built as a shared library + # but we're linking against boost statically, we still + # need to make boost think it's being built as a shared + # library, so that it properly exports its symbols + result += BOOST_ALL_DYN_LINK ; + } + if gcc in $(properties) && shared in $(properties) { result += on ; diff --git a/include/libtorrent/config.hpp b/include/libtorrent/config.hpp index 7775feb27..f484ef894 100644 --- a/include/libtorrent/config.hpp +++ b/include/libtorrent/config.hpp @@ -60,6 +60,11 @@ POSSIBILITY OF SUCH DAMAGE. #endif #endif +#if defined TORRENT_BUILDING_SHARED +# define TORRENT_EXPORT BOOST_SYMBOL_EXPORT +#elif defined TORRENT_LINKING_SHARED +# define TORRENT_EXPORT BOOST_SYMBOL_IMPORT +#endif // ======= GCC ========= @@ -69,24 +74,10 @@ POSSIBILITY OF SUCH DAMAGE. # define TORRENT_DEPRECATED __attribute__ ((deprecated)) # endif -// GCC pre 4.0 did not have support for the visibility attribute -# if __GNUC__ >= 4 -# if defined(TORRENT_BUILDING_SHARED) || defined(TORRENT_LINKING_SHARED) -# define TORRENT_EXPORT __attribute__ ((visibility("default"))) -# endif -# endif - - // ======= SUNPRO ========= #elif defined __SUNPRO_CC -# if __SUNPRO_CC >= 0x550 -# if defined(TORRENT_BUILDING_SHARED) || defined(TORRENT_LINKING_SHARED) -# define TORRENT_EXPORT __global -# endif -# endif - // SunPRO seems to have an overly-strict // definition of POD types and doesn't // seem to allow boost::array in unions @@ -107,12 +98,6 @@ POSSIBILITY OF SUCH DAMAGE. #pragma warning(disable: 4996) #define strdup _strdup -# if defined(TORRENT_BUILDING_SHARED) -# define TORRENT_EXPORT __declspec(dllexport) -# elif defined(TORRENT_LINKING_SHARED) -# define TORRENT_EXPORT __declspec(dllimport) -# endif - #define TORRENT_DEPRECATED_PREFIX __declspec(deprecated) #endif