本文整理汇总了C++中IPlugin::create方法的典型用法代码示例。如果您正苦于以下问题:C++ IPlugin::create方法的具体用法?C++ IPlugin::create怎么用?C++ IPlugin::create使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IPlugin
的用法示例。
在下文中一共展示了IPlugin::create方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: load
IPlugin* load(const char* path) override
{
g_log_info.log("plugins") << "loading plugin " << path;
typedef IPlugin* (*PluginCreator)(Engine&);
Library* lib = Library::create(Path(path), m_engine.getAllocator());
if (lib->load())
{
PluginCreator creator = (PluginCreator)lib->resolve("createPlugin");
if (creator)
{
IPlugin* plugin = creator(m_engine);
if (!plugin->create())
{
m_engine.getAllocator().deleteObject(plugin);
ASSERT(false);
return nullptr;
}
m_plugins.push(plugin);
m_libraries.push(lib);
g_log_info.log("plugins") << "plugin loaded";
return plugin;
}
}
Library::destroy(lib);
return 0;
}
示例2: load
IPlugin* load(const char* path) override
{
g_log_info.log("plugins") << "loading plugin " << path;
typedef IPlugin* (*PluginCreator)(Engine&);
auto* lib = loadLibrary(path);
if (lib)
{
PluginCreator creator = (PluginCreator)getLibrarySymbol(lib, "createPlugin");
if (creator)
{
IPlugin* plugin = creator(m_engine);
if (!plugin || !plugin->create())
{
LUMIX_DELETE(m_engine.getAllocator(), plugin);
ASSERT(false);
return nullptr;
}
m_plugins.push(plugin);
m_libraries.push(lib);
m_library_loaded.invoke(lib);
g_log_info.log("plugins") << "plugin loaded";
return plugin;
}
}
unloadLibrary(lib);
return 0;
}