Opened 13 years ago

Closed 13 years ago

#3934 closed Bugs (fixed)

serialization assertion failure on windows using DLLs

Reported by: cris@… Owned by: Robert Ramey
Milestone: Boost 1.43.0 Component: serialization
Version: Boost 1.42.0 Severity: Regression
Keywords: Cc: crispin.boylan@…

Description

On Windows I get an assertion failure in void_cast.cpp line 225 with the following scenario:

DLL 1 has concrete class C which inherits from virtual B, which inherits from virtual A. BOOST_CLASS_EXPORT(C) is used.

a static C exists.

DLL 2 has concrete class D which inherits from virtual B. BOOST_CLASS_EXPORT(D) is used.

a static D exists and will be instantiated when the library is loaded.

main.cpp - contains an instantiation of D to make main.exe depend on both DLL 1 and DLL 2.

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.

Attachments (6)

b.cpp (1.3 KB ) - added by cris@… 13 years ago.
Code for DLL 1
d.cpp (682 bytes ) - added by cris@… 13 years ago.
Code for DLL 2
main.cpp (172 bytes ) - added by cris@… 13 years ago.
code for main.exe
b.h (826 bytes ) - added by cris@… 13 years ago.
Header for DLL 1
d.h (383 bytes ) - added by cris@… 13 years ago.
header for DLL 2
build.cmd (238 bytes ) - added by cris@… 13 years ago.
simple command line build for the example

Download all attachments as: .zip

Change History (10)

by cris@…, 13 years ago

Attachment: b.cpp added

Code for DLL 1

by cris@…, 13 years ago

Attachment: d.cpp added

Code for DLL 2

by cris@…, 13 years ago

Attachment: main.cpp added

code for main.exe

by cris@…, 13 years ago

Attachment: b.h added

Header for DLL 1

by cris@…, 13 years ago

Attachment: d.h added

header for DLL 2

by cris@…, 13 years ago

Attachment: build.cmd added

simple command line build for the example

comment:1 by crispin.boylan@…, 13 years ago

Cc: crispin.boylan@… added

comment:2 by Robert Ramey, 13 years ago

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.

Thanks for helping out on this.

Robert Ramey

comment:3 by cris@…, 13 years ago

I can certainly have a look in UNIX, although my actual program runs fine there with all versions of boost.

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.

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).

comment:4 by Robert Ramey, 13 years ago

Resolution: fixed
Status: newclosed

I've looked at this and conclude that for now at least I'm just going to comment out the code which traps.

"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)."

I would be curious to know what these pragmas are. At a minimum, this information should be added to the documentation.

Robert Ramey

Note: See TracTickets for help on using tickets.