Font as a non class static fails DLL loading


#1

I bumped into a weird problem after updating to JUCE 3, that caused all hosts to unload my plugin DLL on an exception immediately after loading it. The reason was that i had a local static Font variable in a non class scope. This didn't cause any trouble in JUCE 2.1.1. I don't know whether this is a bug or not, but it took me a while to find this and i thought this post might save someone a good deal of time.


#2

Ouch, yes - asking it to initialise all the font engine code before the DLL has even started-up isn't wise.

Said it a million times: Avoid file-static objects! Use function-statics instead for complex objects, or better still, don't use statics at all where it can be avoided.