I've just started to work with the poco library to get a cross-platform plugin system for my application running. I'd like to use the classloader to load classes found in shared libraries. So far, I've managed to compile the lib and get the sample code from the pdf file running:
- Code: Select all
try
{
PluginLoader loader;
std::string libName("GameOfLife");
libName += Poco::SharedLibrary::suffix(); // append .dll or .so
loader.loadLibrary(libName);
{ // This is for the iterators to go out of scope so the lib can be unloaded later
PluginLoader::Iterator it(loader.begin());
PluginLoader::Iterator end(loader.end());
for (; it != end; ++it)
{
m_logger->logMessage("lib path: " + String(it->first.c_str()));
PluginManifest::Iterator itMan(it->second->begin());
PluginManifest::Iterator endMan(it->second->end());
for (; itMan != endMan; ++itMan)
m_logger->logMessage("Found " + String(itMan->name()));;
}
}
loader.unloadLibrary(libName);
m_logger->logMessage("Lib unloaded");
}
catch (exception &e)
{
m_logger->logMessage("Exception occured while loading plugin libraries: " + String(e.what()));
}
catch (...)
{
m_logger->logMessage("General Exception occured while loading plugin libraries.");
}
All of this is placed inside the constructor of one of my main classes. m_logger is a logfile. I guess everything else should be clear.
(Don't be confused with the String stuff. I'm working with JUCE and use most of its classes for my main application).
It loads the lib and finds the class inside it. The problem is, that the application hangs on the unloadLibrary() call. There is no exception! The logfile looks like this:
- Code: Select all
**********************************************************
Welcome
Log started: 22 Jul 2012 12:49:01pm
lib path: GameOfLife.dll
Found AppGameOfLife
My main application is a vst-music plugin and I use MS Visual C++ Express under Win7. Therefore I can't attach the debugger to it to see whats going on...
Thanks a lot for hints and tipps.
StrangeMan





