Boost logo

Boost Users :

From: David Raulo (david.raulo_at_[hidden])
Date: 2007-09-10 15:11:47


Hi,

It seems I have linker-related problems leading to "unregistered class"
exceptions being raised. Now, I know this sounds like a compilation
chain-specific problem, but the thing is I get the exact same problem
on Linux (Ubuntu 7.04, gcc4.1), Macosx 10.4 (gcc 4.0) and Windows
(Microsoft Visual Studio 2005 Express).

My initial problem was that I'm using Boost.Serialization on a rather
big class hierarchy (around 200 classes), so instantiating all the
serialization code in a single .cpp is not pratical (too much memory
consumed by the compiler). So I split my BOOST_CLASS_EXPORT_GUID()
declarations into several compilation units, and this worked fine.
*Except* if I generate a static library, in which case I get
unregistered class exceptions.

If I take the same object files and link them into a dynamic library,
or directly into my executable, then everything works as intended. So
it looks like generating a static library (with gcc or msvc) leads to
parts of the serialization code to disappear (a quick look at the
file-size of the generated executables seems to confirm that).

I attached the smallest test-case I could think of that reproduces this
problem. The included Makefile will generate 3 executables: test_s11n,
test_s11n_dyn, test_s11n_static. All of them build fine, but the last
one fails at run-time.

Anyone has some insight into this?
Thanks,

david.








Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net