"The host application did not reload the plugin properly"

Hi,

I realize this is slightly off topic, but I’m stumped and since it’s a Steinberg plugin I’m hoping for a little insight.

I’m getting this error from Halion 7 in the host program (Cantabile) that I’m the developer on:

image

It happens in this scenario:

  1. Load Halion module
  2. Create 2 or more instances of the plugin
  3. Close the 2 plugin instances
  4. Unload the Halion module
  5. On loading the Halion module again, during the call to InitDll the message above is displayed and InitDll returns false.
  6. Attempting to load the module again crashes in the next call to InitDll.

If only a single instance is created in step 2 everything works fine.

Anybody have any clue what I might be doing wrong to cause this? I don’t see issues like this with any other plugins. What’s the “proper” way to reload a plugin?

Any help much appreciated.
Brad

Do you call ExitDll before calling UnloadLibrary?

Hi Arne,

Thanks for answering…

Yep, module unload goes like this:

  1. Call IPluginFactory::Release()
  2. Call GetProcAddress("ExitDll") and call it (for Halion it takes a few seconds to return)
  3. Call FreeLibrary(hModule)

(I forgot to mention, but this is on Windows)

I just checked the code and you get this message because the halion.dll was not unloaded from the process. This can only happen (as long as I know) when there are more LoadLibrary() calls than FreeLibrary() ones.

Hi @Arne_Scheffler,

Thanks so much… this was the clue I needed:

I had a bug in the module loading where on the second plugin instance it does a load library, checks the module handle in a table and if found doesn’t re-initialize it… but I forget to free that extra load library reference.

Brad

Hi guys,

I get the same error with Cantabile and HALion Sonic; I’m pretty new to Cantabile so I didn’t really follow what the solution was?

I’d be eternally grateful if someone could point me in the right direction.

Kind regards,

George Wood

@Promedia I already replied to your post on the Cantabile forum explaining how to get the fix.