No plugins built prior to the symbol naming change in 4fc6cb6f can
be loaded in DFHack for v0.42.
develop
lethosor 2016-01-01 11:20:54 -05:00
parent d0c28d3f50
commit 93fe222c35
1 changed files with 2 additions and 15 deletions

@ -273,23 +273,13 @@ bool Plugin::load(color_ostream &con)
plugin_abort_load; \ plugin_abort_load; \
return false; \ return false; \
} }
#define plugin_check_symbols(sym1,sym2) \
if (!LookupPlugin(plug, sym1) && !LookupPlugin(plug, sym2)) \
{ \
con.printerr("Plugin %s: missing symbols: %s & %s\n", name.c_str(), sym1, sym2); \
plugin_abort_load; \
return false; \
}
plugin_check_symbols("plugin_name", "name") // allow r3 plugins plugin_check_symbol("plugin_name")
plugin_check_symbols("plugin_version", "version") // allow r3 plugins plugin_check_symbol("plugin_version")
plugin_check_symbol("plugin_self") plugin_check_symbol("plugin_self")
plugin_check_symbol("plugin_init") plugin_check_symbol("plugin_init")
plugin_check_symbol("plugin_globals") plugin_check_symbol("plugin_globals")
const char ** plug_name =(const char ** ) LookupPlugin(plug, "plugin_name"); const char ** plug_name =(const char ** ) LookupPlugin(plug, "plugin_name");
if (!plug_name) // allow r3 plugin naming
plug_name = (const char ** )LookupPlugin(plug, "name");
if (name != *plug_name) if (name != *plug_name)
{ {
con.printerr("Plugin %s: name mismatch, claims to be %s\n", name.c_str(), *plug_name); con.printerr("Plugin %s: name mismatch, claims to be %s\n", name.c_str(), *plug_name);
@ -297,9 +287,6 @@ bool Plugin::load(color_ostream &con)
return false; return false;
} }
const char ** plug_version =(const char ** ) LookupPlugin(plug, "plugin_version"); const char ** plug_version =(const char ** ) LookupPlugin(plug, "plugin_version");
if (!plug_version) // allow r3 plugin version
plug_version =(const char ** ) LookupPlugin(plug, "version");
const char ** plug_git_desc_ptr = (const char**) LookupPlugin(plug, "plugin_git_description"); const char ** plug_git_desc_ptr = (const char**) LookupPlugin(plug, "plugin_git_description");
Plugin **plug_self = (Plugin**)LookupPlugin(plug, "plugin_self"); Plugin **plug_self = (Plugin**)LookupPlugin(plug, "plugin_self");
const char *dfhack_version = Version::dfhack_version(); const char *dfhack_version = Version::dfhack_version();