From: Patrick Frants (gclbb-jamboost_at_[hidden])
Date: 2002-08-26 10:13:48
Rene Rivera <grafik666_at_[hidden]> wrote in
> But I have a question... why isn't a static lib(archive) suitable? It
> should not have any problems with static inits for C++... Or at least
> it works for me with GCC.
:-). Officially static instance initialization may be deferred until the
first call to a function in the same file as the static instance. Under MSVC
static instances that reside in object files that are linked directly to the
executables get initialized (even if no function in the file is called
directly!). Moving such an object file to a library and linking with the
library results in the instance not getting initialized...
There is a workaround by having empty initialization functions in each .cpp
file and calling them from a function in the main file. I think that is a
hack and therefore we link with the individual object files instead.
-- Patrick Frants Senior Software Engineer Quintiq mailto:patrick_at_[hidden] www.quintiq.com
Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk