i want to create a simple plugin interface for my app
in short a create a dll that exports a entry and exit symbols
they look like this
extern "C" __declspec (dllexport) Component* dynamicComponentEntry(void)
{
initialiseJuce_GUI();
return (contentComponent = new DynamicComponent());
}
extern "C" __declspec (dllexport) void dynamicComponentExit(void)
{
deleteAndZero (contentComponent);
shutdownJuce_GUI();
}
they create a new JUCE component and delete it when the host asks.
in the host i do
typedef Component* (*dynamicComponentEntry)(void);
typedef void (*dynamicComponentExit)(void);
dllHandle = PlatformUtilities::loadDynamicLibrary (T("DynamicComponent\\DynamicComponent.dll"));
entryHandle = dynamicComponentEntry)PlatformUtilities::getProcedureEntryPoint (dllHandle, T("dynamicComponentEntry"));
exitHandle = (dynamicComponentExit)PlatformUtilities::getProcedureEntryPoint (dllHandle, T("dynamicComponentExit"));
Component *component = (entryHandle)();
at this point i can call component->getName() for example and it works
but when in the host i try to do:
// this works
Logger::writeToLog (T("Plugin::ctor loaded component name: ") + component->getName());
// this does not
DialogWindow::showModalDialog (T("plugin"), component, 0, Colours::white, true, false, false);
this fails on
// not possible to check on an already-deleted object..
jassert (componentToWatch_->isValidComponent());
what am i doing wrong here ? it looks like the component is not valid, getName() works but i can’t display this component.
is there something i should know about?