//---------------------------------------- // main //---------------------------------------- int main(int /*argc*/, char** /*argv*/) { PrepareConsoleLogger logger(Poco::Logger::ROOT, Poco::Message::PRIO_INFORMATION); ScopedLogMessage msg("SharedLibraryTest ", "start", "end"); std::string path(kSharedLibraryName); path.append(Poco::SharedLibrary::suffix()); Poco::SharedLibrary library; try { library.load(path); if(library.isLoaded()) { msg.Message(Poco::format(" \"%s\" is loaded", path)); std::string str; try { HelloFunc func = reinterpret_cast<HelloFunc>(library.getSymbol(kFunctionName)); func(str); library.unload(); msg.Message(Poco::format(" %s", str)); } catch(Poco::NotFoundException& exc) { msg.Message(Poco::format(" %s \"%s\"", std::string(exc.name()), kFunctionName)); } } } catch(Poco::LibraryLoadException& exc) { msg.Message(Poco::format(" %s \"%s\"", std::string(exc.name()), path)); } return 0; }