Opened 13 years ago
Closed 13 years ago
#3934 closed Bugs (fixed)
serialization assertion failure on windows using DLLs
| Reported by: | 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)
Change History (10)
by , 13 years ago
comment:1 by , 13 years ago
| Cc: | added |
|---|
comment:2 by , 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 , 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 , 13 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
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

Code for DLL 1