Assign CreateInterface member instead of creating a new variable (#705)

Assign CreateInterface member instead of creating a new variable. This fixes valid Plugins failing to load.
This commit is contained in:
Jan 2024-06-15 12:39:35 +02:00 committed by GitHub
parent a06319c974
commit d8d861c3db
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -45,15 +45,15 @@ Plugin::Plugin(std::string path) : m_location(path)
m_initData = {.pluginHandle = m_handle};
CreateInterfaceFn CreatePluginInterface = (CreateInterfaceFn)GetProcAddress(m_handle, "CreateInterface");
m_pCreateInterface = (CreateInterfaceFn)GetProcAddress(m_handle, "CreateInterface");
if (!CreatePluginInterface)
if (!m_pCreateInterface)
{
NS::log::PLUGINSYS->error("Plugin at '{}' does not expose CreateInterface()", path);
return;
}
m_pluginId = (IPluginId*)CreatePluginInterface(PLUGIN_ID_VERSION, 0);
m_pluginId = (IPluginId*)m_pCreateInterface(PLUGIN_ID_VERSION, 0);
if (!m_pluginId)
{
@ -97,7 +97,7 @@ Plugin::Plugin(std::string path) : m_location(path)
return;
}
m_callbacks = (IPluginCallbacks*)CreatePluginInterface("PluginCallbacks001", 0);
m_callbacks = (IPluginCallbacks*)m_pCreateInterface("PluginCallbacks001", 0);
if (!m_callbacks)
{