aboutsummaryrefslogtreecommitdiff
path: root/backends/plugins
diff options
context:
space:
mode:
authorJordi Vilalta Prat2008-02-08 01:02:25 +0000
committerJordi Vilalta Prat2008-02-08 01:02:25 +0000
commit00987db3a97f37439cfc6e70991a08fde424d2b3 (patch)
tree5b537564da7280d60668bd947e31d7b4c6e1e087 /backends/plugins
parentc103290e2b123510e9d9eb4716ae0336a9e61ede (diff)
downloadscummvm-rg350-00987db3a97f37439cfc6e70991a08fde424d2b3.tar.gz
scummvm-rg350-00987db3a97f37439cfc6e70991a08fde424d2b3.tar.bz2
scummvm-rg350-00987db3a97f37439cfc6e70991a08fde424d2b3.zip
Implemented plugin versioning
svn-id: r30826
Diffstat (limited to 'backends/plugins')
-rw-r--r--backends/plugins/dynamic-plugin.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/backends/plugins/dynamic-plugin.h b/backends/plugins/dynamic-plugin.h
index 4b46c31ace..3825f28c87 100644
--- a/backends/plugins/dynamic-plugin.h
+++ b/backends/plugins/dynamic-plugin.h
@@ -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) {