aboutsummaryrefslogtreecommitdiff
path: root/base/plugins.h
diff options
context:
space:
mode:
authorAndre Heider2010-09-15 07:44:08 +0000
committerAndre Heider2010-09-15 07:44:08 +0000
commit2596143e2bc42f5958e446ba6c156402ee1a8d53 (patch)
tree27838a251050826a5a59574f2064f70365900c1f /base/plugins.h
parent76ca653972f5513d46c00889b57c7a13e41859a9 (diff)
downloadscummvm-rg350-2596143e2bc42f5958e446ba6c156402ee1a8d53.tar.gz
scummvm-rg350-2596143e2bc42f5958e446ba6c156402ee1a8d53.tar.bz2
scummvm-rg350-2596143e2bc42f5958e446ba6c156402ee1a8d53.zip
PLUGINS: Additional plugin check for the ELF loader.
The ELF loader does not have access to the symbols of the main executable, it just relocates symbols to it via fixed offsets. We need to make sure that loaded plugins are from the same link process to prevent crashes. An embedded build date is used for that. svn-id: r52730
Diffstat (limited to 'base/plugins.h')
-rw-r--r--base/plugins.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/base/plugins.h b/base/plugins.h
index 0893312102..5472ab2fce 100644
--- a/base/plugins.h
+++ b/base/plugins.h
@@ -30,6 +30,7 @@
#include "common/error.h"
#include "common/singleton.h"
#include "common/util.h"
+#include "backends/plugins/elf/version.h"
namespace Common {
class FSList;
@@ -98,6 +99,13 @@ extern int pluginTypeVersions[PLUGIN_TYPE_MAX];
#define PLUGIN_DYNAMIC_DSO_HANDLE
#endif
+#ifdef USE_ELF_LOADER
+#define PLUGIN_DYNAMIC_BUILD_DATE \
+ PLUGIN_EXPORT const char *PLUGIN_getBuildDate() { return gScummVMPluginBuildDate; }
+#else
+#define PLUGIN_DYNAMIC_BUILD_DATE
+#endif
+
/**
* REGISTER_PLUGIN_STATIC is a convenience macro which is used to declare
* the plugin interface for static plugins. Code (such as game engines)
@@ -128,6 +136,7 @@ extern int pluginTypeVersions[PLUGIN_TYPE_MAX];
#define REGISTER_PLUGIN_DYNAMIC(ID,TYPE,PLUGINCLASS) \
extern "C" { \
PLUGIN_DYNAMIC_DSO_HANDLE \
+ PLUGIN_DYNAMIC_BUILD_DATE \
PLUGIN_EXPORT int32 PLUGIN_getVersion() { return PLUGIN_VERSION; } \
PLUGIN_EXPORT int32 PLUGIN_getType() { return TYPE; } \
PLUGIN_EXPORT int32 PLUGIN_getTypeVersion() { return TYPE##_VERSION; } \