Re: [Boost-bugs] [Boost C++ Libraries] #4670: Revised boost/config/compiler/gcc.hpp causes linker errors for Cygwin WIN32 apps

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #4670: Revised boost/config/compiler/gcc.hpp causes linker errors for Cygwin WIN32 apps
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2010-10-08 09:24:03


#4670: Revised boost/config/compiler/gcc.hpp causes linker errors for Cygwin WIN32
apps
------------------------------------+---------------------------------------
  Reporter: cvclarkeiii@… | Owner: johnmaddock
      Type: Bugs | Status: reopened
 Milestone: To Be Determined | Component: serialization
   Version: Boost 1.44.0 | Severity: Problem
Resolution: | Keywords:
------------------------------------+---------------------------------------
Changes (by johnmaddock):

  * status: closed => reopened
  * resolution: fixed =>
  * component: config => serialization

Comment:

 I've tracked this down to a bug in the serialization library, so I'm
 reassigning the issue.

 Robert, here's the problem: When basic_iarchive.cpp is compiled the class
 "extened_type_info" is declared dllimport, as a result the linker is
 looking for the member functions of that class in a dll... except they're
 not present in an external dll, they're present in *this* dll and marked
 dllexport.

 Here's what gcc is doing here: dllexport just marks the symbol as visible,
 but doesn't change it's mangled name. dllimport changes the mangled name
 instructs the linker to create stub code for that symbol with the __imp__
 prefix that looks for the unmangled name in an external dll. Hense you
 can't mix import and export of the same symbol in the same dll. The same
 code compiles with msvc and gcc on linux due to chance really - they just
 happen to treat import and export as largely the same thing.

 In other words in the serialization sources - since each .cpp file appears
 in only one library, there should be just 2 source macros, lets say
 BOOST_SERIALIZATION_SOURCE and BOOST_WSERIALIZATION_SOURCE that control
 what gets built with import or export. BOOST_ARCHIVE_SOURCE can
 presumably be replaced by BOOST_SERIALIZATION_SOURCE and associated macros
 since all the archive sources are really just part of the narrow character
 serialization lib, and not a separate lib in their own right? Further
 these macros should be defined *before any serialization or archive
 headers are included*, otherwise you run the risk of inconsistent settings
 again.

 HTH, John.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/4670#comment:4>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:04 UTC