rely on boost configs symbol export macro, make sure boost thinks it is built as a shared library when linked into a shared library

This commit is contained in:
Arvid Norberg 2012-03-13 15:35:35 +00:00
parent 250f1645b3
commit 7f2d6325df
2 changed files with 14 additions and 20 deletions

View File

@ -161,6 +161,15 @@ rule linking ( properties * )
{
if <boost-link>static in $(properties)
{
if <link>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 += <define>BOOST_ALL_DYN_LINK ;
}
if <toolset>gcc in $(properties) && <link>shared in $(properties)
{
result += <fpic>on ;

View File

@ -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