Implemented plugin versioning

svn-id: r30826
This commit is contained in:
Jordi Vilalta Prat 2008-02-08 01:02:25 +00:00
parent c103290e2b
commit 00987db3a9
4 changed files with 39 additions and 2 deletions

View file

@ -39,6 +39,17 @@ protected:
public:
virtual bool loadPlugin() {
// Validate the plugin API version
IntFunc verFunc = (IntFunc)findSymbol("PLUGIN_getVersion");
if (!verFunc) {
unloadPlugin();
return false;
}
if (verFunc() != PLUGIN_VERSION) {
unloadPlugin();
return false;
}
// Get the type of the plugin
IntFunc typeFunc = (IntFunc)findSymbol("PLUGIN_getType");
if (!typeFunc) {
@ -51,6 +62,17 @@ public:
return false;
}
// Validate the plugin type API version
IntFunc typeVerFunc = (IntFunc)findSymbol("PLUGIN_getTypeVersion");
if (!typeVerFunc) {
unloadPlugin();
return false;
}
if (typeVerFunc() != pluginTypeVersions[_type]) {
unloadPlugin();
return false;
}
// Get the plugin's instantiator object
GetObjectFunc getObject = (GetObjectFunc)findSymbol("PLUGIN_getObject");
if (!getObject) {