Boost C++ Libraries: Ticket #3934: serialization assertion failure on windows using DLLs https://svn.boost.org/trac10/ticket/3934 <p> On Windows I get an assertion failure in void_cast.cpp line 225 with the following scenario: </p> <p> DLL 1 has concrete class C which inherits from virtual B, which inherits from virtual A. BOOST_CLASS_EXPORT(C) is used. </p> <p> a static C exists. </p> <p> DLL 2 has concrete class D which inherits from virtual B. BOOST_CLASS_EXPORT(D) is used. </p> <p> a static D exists and will be instantiated when the library is loaded. </p> <p> main.cpp - contains an instantiation of D to make main.exe depend on both DLL 1 and DLL 2. </p> <p> this same test passes on UNIX. It's as if on windows it is trying to register B twice. Taking out the assert (as was the case in all previous boost versions) makes things work ok. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/3934 Trac 1.4.3 cris@… Tue, 16 Feb 2010 10:36:52 GMT attachment set https://svn.boost.org/trac10/ticket/3934 https://svn.boost.org/trac10/ticket/3934 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">b.cpp</span> </li> </ul> <p> Code for DLL 1 </p> Ticket cris@… Tue, 16 Feb 2010 10:37:13 GMT attachment set https://svn.boost.org/trac10/ticket/3934 https://svn.boost.org/trac10/ticket/3934 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">d.cpp</span> </li> </ul> <p> Code for DLL 2 </p> Ticket cris@… Tue, 16 Feb 2010 10:37:49 GMT attachment set https://svn.boost.org/trac10/ticket/3934 https://svn.boost.org/trac10/ticket/3934 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">main.cpp</span> </li> </ul> <p> code for main.exe </p> Ticket cris@… Tue, 16 Feb 2010 10:38:10 GMT attachment set https://svn.boost.org/trac10/ticket/3934 https://svn.boost.org/trac10/ticket/3934 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">b.h</span> </li> </ul> <p> Header for DLL 1 </p> Ticket cris@… Tue, 16 Feb 2010 10:38:34 GMT attachment set https://svn.boost.org/trac10/ticket/3934 https://svn.boost.org/trac10/ticket/3934 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">d.h</span> </li> </ul> <p> header for DLL 2 </p> Ticket cris@… Tue, 16 Feb 2010 10:46:09 GMT attachment set https://svn.boost.org/trac10/ticket/3934 https://svn.boost.org/trac10/ticket/3934 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">build.cmd</span> </li> </ul> <p> simple command line build for the example </p> Ticket crispin.boylan@… Tue, 16 Feb 2010 10:48:54 GMT cc set https://svn.boost.org/trac10/ticket/3934#comment:1 https://svn.boost.org/trac10/ticket/3934#comment:1 <ul> <li><strong>cc</strong> <span class="trac-author">crispin.boylan@…</span> added </li> </ul> Ticket Robert Ramey Fri, 26 Feb 2010 07:15:46 GMT <link>https://svn.boost.org/trac10/ticket/3934#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3934#comment:2</guid> <description> <p> I've been looking into this. It looks to me that just instantiating D or C in the main module will instantiate all the code in the class which will trigger an export. At least it looks this way on windows/msvc. Could you investigate with unix by running the debugger to see if it happens with unix. There is also the question of whether it's the gcc vs msvc. I should be able to check that here as I can compile and test gcc under cygwin. </p> <p> Thanks for helping out on this. </p> <p> Robert Ramey </p> </description> <category>Ticket</category> </item> <item> <author>cris@…</author> <pubDate>Fri, 26 Feb 2010 09:15:07 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/3934#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3934#comment:3</guid> <description> <p> I can certainly have a look in UNIX, although my actual program runs fine there with all versions of boost. </p> <p> Interestingly (perhaps), I can make my UNIX builds fail with multiple code instantiated on 1.42 if using gcc -fvisibility=hidden and explicitly only exporting the same symbols as in my windows build. With 1.39 and the -fvisibility=hidden flag I get 'unregistered void cast' on UNIX. On 1.40 on Windows with basically the same thing (same exports handled by dllexport) I get a working program. </p> <p> To use visibility=hidden to work at all I can put pragmas to enable default visibility around the boost include macros (export.hpp, text_oarchive, text_iarchive). </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Robert Ramey</dc:creator> <pubDate>Sun, 07 Mar 2010 21:02:19 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/3934#comment:4 https://svn.boost.org/trac10/ticket/3934#comment:4 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> I've looked at this and conclude that for now at least I'm just going to comment out the code which traps. </p> <p> "To use visibility=hidden to work at all I can put pragmas to enable default visibility around the boost include macros (export.hpp, text_oarchive, text_iarchive)." </p> <p> I would be curious to know what these pragmas are. At a minimum, this information should be added to the documentation. </p> <p> Robert Ramey </p> Ticket