aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlloyd <[email protected]>2010-07-28 04:34:57 +0000
committerlloyd <[email protected]>2010-07-28 04:34:57 +0000
commit06dbe9a68cf09213e1b63fecf8a91fe386508c63 (patch)
tree1af9275ff673a132721b0ec4348645d4be032d3c
parent0c0655ea9c97618716fe2f11355e81b6f6a7a81b (diff)
Add a version info function which returns a u32bit. The currently
expected value is 20100728 (ie, today). This will allow for checking for and/or working around changes to interfaces.
-rw-r--r--src/engine/dyn_engine/dyn_engine.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/engine/dyn_engine/dyn_engine.cpp b/src/engine/dyn_engine/dyn_engine.cpp
index 2dc76d7d6..2a1f14e8d 100644
--- a/src/engine/dyn_engine/dyn_engine.cpp
+++ b/src/engine/dyn_engine/dyn_engine.cpp
@@ -15,6 +15,7 @@ namespace {
extern "C" {
typedef Engine* (*creator_function)(void);
typedef void (*destructor_function)(Engine*);
+ typedef u32bit (*module_version)(void);
}
}
@@ -27,7 +28,17 @@ Dynamically_Loaded_Engine::Dynamically_Loaded_Engine(
try
{
- creator_function creator = lib->resolve<creator_function>("create_engine");
+ module_version version =
+ lib->resolve<module_version>("module_version");
+
+ u32bit mod_version = version();
+
+ if(mod_version != 20100728)
+ throw std::runtime_error("Unexpected or incompatible version in " +
+ library_path);
+
+ creator_function creator =
+ lib->resolve<creator_function>("create_engine");
engine = creator();