Re: Initialization of static anonymous-namespace members from a
dynamically loaded lib
On Jan 9, 9:00 pm, "Alf P. Steinbach /Usenet" <alf.p.steinbach
+use...@gmail.com> wrote:
* m0shbear, on 09.01.2011 21:56:
[...]
Is it even possible to have file-scope non-POD statics upon
whose operations do not invoke UB, inside a d-l lib?
The C++ standard does not address or even acknowledge the
existence of dynamically loaded libraries except that one can
interpret some wording about delayed initialization as
pertaining to dynamically loaded libraries.
Yes, but most C++ compilers do permit dynamically loaded
objects. (I don't know of any that can dynamically load a
library. But despite the name, under Windows, a DLL is not a
library.)
Anyway, the short of it is that in Windows you can generally
rely on techniques such as above, but not in *nix.
Under which Unix does it fail? I've used the technique a lot
under various Unices, and I've never known it to fail. (I can
guarantee that it works correctly under Solaris and Linux,
because those are the Unices I currently have access to, but I
can't remember every seeing it fail.)
--
James Kanze