On 23/06/2012 14:09, Jürgen Hunold wrote:
Hi Ken,
On Saturday, 23. June 2012 13:51:52 Ken wrote:
In porting from 1_41 to 1_49 on mingw this no longer links because the
boost::archive::basic_xml_grammar<char> class's symbols are no longer
exported from the serialization library.
This sounds odd. Are you sure you are setting BOOST_ALL_DYN_LINK and/or
BOOST_SERIALIZATION_DYN_LINK during compilation?
The export/import magic looks fine to me.
And please provide a compilable testcase. There are flags and #defines which
might trigger this behaviour.
Yours,
Jürgen
Thanks Jürgen. No, we are not setting BOOST_SERIALIZATION_DYN_LINK.
Where should that be defined?
A minimal test case is below.
The evidence I was using, maybe erroneously, to claim that
boost::archive::basic_xml_grammar<char> symbols are not exported is that
a) nm stage/lib/libboost_serialization-mgw44-1_49.dll.a | grep grammar
produces nothing.
b) The file boost/archive/impl/basic_xml_grammar.hpp contains
declarations only. The implementation is defined in
libs/serialization/src/basic_xml_grammar.ipp and
libs/serialization/src/xml_grammar.cpp. Unlike the other serialization
classes, the code does not use BOOST_ARCHIVE_DECL or equivalent to
export the symbols.
Regards,
Ken
===================================
xmlia.hpp
# if ! defined __xmliarchive_h_
# define __xmliarchive_h_
#include
class XmlInputArchive :
public boost::archive::xml_iarchive_impl< XmlInputArchive >,
public boost::archive::detail::shared_ptr_helper
{
typedef boost::archive::xml_iarchive_impl< XmlInputArchive > Base;
public:
XmlInputArchive( std::istream& is, unsigned int flags = 0 );
void load_start( const char * name );
void load_end( const char * name );
};
BOOST_SERIALIZATION_REGISTER_ARCHIVE( XmlInputArchive )
# endif
=======================================
xmlia.cpp
#include "xmlia.hpp"
#include
#include
XmlInputArchive::XmlInputArchive( std::istream & is, unsigned int flags )
: boost::archive::xml_iarchive_impl< XmlInputArchive >( is, flags )
{
}
void XmlInputArchive::load_start( const char * name )
{
}
void XmlInputArchive::load_end( const char * name )
{
}
=========================================
Compiled and linked like this:
g++ -c -D__STDC_CONSTANT_MACROS -I. -O3 -frtti -fexceptions -mthreads
-Wall -Wno-non-virtual-dtor -Wno-ctor-dtor-privacy -Wno-strict-aliasing
-DUNICODE -I'c:/Boost/boost_1_49_0' -o release/xmlia.o xmlia.cpp
g++ -enable-stdcall-fixup -Wl,-enable-auto-import
-Wl,-enable-runtime-pseudo-reloc -Wl,-s -shared -export-all-symbols
-mthreads -Wl -Wl,--out-implib,release/libarchive_r.a
-orelease/archive_r.dll release/xmlia.o
-Lc:/Boost/boost_1_49_0/stage/lib -lboost_serialization-mgw44-1_49
g++ is from the Qt mingw toolkit c:/Qt/2010.05/mingw/bin/g++
g++ --version => g++.exe (GCC) 4.4.0