What is the proper way to unload a plugin?

Hi,

no matter how deep I crawl the library sources, I can’t yet seem to find out how to properly unload a plugin (say, Kontakt 3) that was previously created with createPluginInstance(…). I first thought looking at the host sample project would help (remove node, etc), but the actual unloading must happen somewhere else, as there is no explicit counterpart to createPluginInstance(…) anywhere. Also, the destructor of AudioPluginInstance is empty.

I want the plugin to free its resources (unload all patches and samples) and then be dropped altogether. The same way a typical host would do.

What is it that I am missing? :?:

TIA,
Andre

EDIT: Basically I am instantiating a single VST/AU at a time, passing it all relevant calls immediately. That’s why I don’t use the AudioProcessorGraph framework here. On a side note, everything works fine, except I can’t unload the plugin when replacing it with another one.

I just use operator delete.

Thanks! I didn’t expect the destructor to be that robust and complete. Rather thought it would be something that returns an error code or the like.