Callback for plugin DLL unload (Windows VST3)

There used to be this

/*
 *  Called when the host unloads our DLL from memory.
 */
void JUCE_CALLTYPE unloadPluginDll() {
}

My plugin relied on that for cleaning up a singleton using statics. That callback isn’t called anymore. Is there something similar available on Windows?

I understand i should avoid statics, but it’s a third party library (VFLib), which i do have the source code, but changing the singleton implementation would be, if even possible, at least tedious and error prone.

The singleton needs a lifetime spanning the lifetime of the DLL.

Statics automatically live only while the DLL is loaded. They need no manual allocation or deallocarion.

In this case, there was some additional cleanup that needed to be done, that didn’t work using destructors. I’m not quite sure why. I ended up changing singletons to use SharedResourcePointer. It was pretty straightforward after all. Thanks for the help!