Boost logo

Boost Users :

Subject: [Boost-users] unwanted exported symbols in a DLL which statically links to Boost.Library
From: Luca Cappa (luca.cappa_at_[hidden])
Date: 2009-04-22 09:22:31


Hello,

I am creating a DLL using the VisualC++ 8sp1, which statically links to
Boost.Library, and also to another static library, which links to
Boost.Library statically too.

In the export section of the built DLL I see, among the few public
functions which it should export, hundreds of exported functions like the
ones below. I would really like to export the symbols the DLL defines as
exported, and not anything else which is unexpectly exported, like the
ones shown below:

boost::archive::detail::oserializer<class
boost::archive::xml_oarchive,struct sqy::Vector2<float>
>::oserializer<class boost::archive::xml_oarchive,struct
sqy::Vector2<float> >(void)

boost::archive::detail::oserializer<class
boost::archive::xml_oarchive,struct sqy::Vector2<float>
>::oserializer<class boost::archive::xml_oarchive,struct
sqy::Vector2<float> >(void)

boost::archive::detail::oserializer<class
boost::archive::xml_oarchive,struct sqy::Vector2<double>
>::oserializer<class boost::archive::xml_oarchive,struct
sqy::Vector2<double> >(void)

In my static library, which statically link to the Boost.Serialization
library, I have the following code which explicitly instantiate some
template type on a set of a priori known datatypes:

template MYLIB_API struct sqy::Vector2<int>;
   template MYLIB_API struct sqy::Vector2<float>;
   template MYLIB_API struct sqy::Vector2<double>;
   template MYLIB_API struct sqy::Vector2<size_t>;

#define INSTANTIATE_VECTOR2_SERIALIZATION(x)\
   template void MYLIB_API
Vector2<x>::serialize<boost::archive::xml_oarchive> (\
   boost::archive::xml_oarchive&, const unsigned int);\
   template void MYLIB_API
Vector2<x>::serialize<boost::archive::xml_iarchive> (\
   boost::archive::xml_iarchive&, const unsigned int);

   INSTANTIATE_VECTOR2_SERIALIZATION(int);
   INSTANTIATE_VECTOR2_SERIALIZATION(float);
   INSTANTIATE_VECTOR2_SERIALIZATION(double);
   INSTANTIATE_VECTOR2_SERIALIZATION(size_t);

Notice that, when the DLL is created, MYLIB_API is defined like

# define MYLIB_API

so i wonder where those symbols above comes from? Anyone could help me to
remove from the DLL exporting section those unwanted symbols?

Many thanks in advance,
Luca


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net