Boost logo

Boost :

From: Emil Dotchevski (emildotchevski_at_[hidden])
Date: 2006-12-13 21:14:14

>> I understand that you need global class registration to handle the
>> case of reading a base pointer when the stream contains derived
>> object, but when you serialize data you just assume that all classes
>> have been registered ahead
>> of time.
> Not necessarily. The export functionality eliminates the requirement to
> explicitly register all derived types. Its original implementation
> initialized the type table upon first usage - the current one intializes
> the type table on start-up. This one of the changes I've been referring
> to in my belief that the situation may no longer exist.

Let me see if I understand how this works. So, in foo.cpp you #include
headers from the serialization lib, and then you say EXPORT(foo) and it
(automatically) registers class foo with all archive classes you've

However I don't see how this can be done automatically. I suppose you're
using some kind of global object to do the registration (because you say
it's done on startup). However, the global object isn't guaranteed to be
initialized at startup, all you know is that it will be initialized before
you enter any function from foo.cpp.

In fact I have seen Metrowerks (correctly) consider a similar "automatic"
registration dead code and remove all foo.cpp code from the executable (not
just the global object, the entire class foo is removed.)

Boost list run by bdawes at, gregod at, cpdaniel at, john at