Separating to 2 DLLs



Following my post I started a POC of trying to separate the Demo plug-in to 2 DLLs,
one with only the JuceVstWrapper and the other with the PluginProcessor.

I changed the call:

AudioProcessor* const filter = createPluginFilter();

to a DLL call:

typedef AudioProcessor* (*MyAudioProcessor)(void);
MyAudioProcessor _audioProcessor;
void* myDLL = PlatformUtilities::loadDynamicLibrary("C:/Program Files (x86)/VstPlugins/MyPlugin.dll");
_audioProcessor = (MyAudioProcessor)PlatformUtilities::getProcedureEntryPoint(myDLL,"GetTheProcessor");
AudioProcessor* const filter = (AudioProcessor*)_audioProcessor();

But when I run it I got this assertion:

ChangeBroadcaster::ChangeBroadcaster() noexcept
    // are you trying to create this object before or after juce has been intialised??
    jassert (MessageManager::instance != nullptr);

    callback.owner = this;
MyPlugIn.dll!juce::ChangeBroadcaster::ChangeBroadcaster()  Line 38 + 0x65 bytes	C++
MyPlugIn.dll!juce::ComponentAnimator::ComponentAnimator()  Line 208 + 0x14 bytes	C++
MyPlugIn.dll!juce::Desktop::Desktop()  Line 43 + 0x15e bytes	C++
MyPlugIn.dll!juce::Desktop::getInstance()  Line 61 + 0x25 bytes	C++
MyPlugIn.dll!juce::LookAndFeel::setDefaultLookAndFeel(juce::LookAndFeel * newDefaultLookAndFeel)  Line 361 + 0x9 bytes	C++
MyPlugIn.dll!MyPlugInAudioProcessor::MyPlugInAudioProcessor()  Line 180 + 0xe bytes	C++
MyPlugIn.dll!GetTheProcessor()  Line 756 + 0x1e bytes	C++
JuceDemoPlugin.dll!`anonymous namespace'::pluginEntryPoint(int (AEffect *, int, int, int, void *, float)* audioMaster)  Line 1507 + 0x3 bytes	C++

I thought that getProcedureEntryPoint() puts the 2 DLL into the same address space so everything should be fine, why do it
says that JUCE is not initialized?



Maybe I should make the 1st DLL (the one that loads my plug-in) just a simple C++ application that exposes the main() for the DAW
and loads the JUCE DLL, that way I’ll have only 1 MessageManager?