diff options
author | lloyd <[email protected]> | 2010-07-28 04:34:57 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2010-07-28 04:34:57 +0000 |
commit | 06dbe9a68cf09213e1b63fecf8a91fe386508c63 (patch) | |
tree | 1af9275ff673a132721b0ec4348645d4be032d3c | |
parent | 0c0655ea9c97618716fe2f11355e81b6f6a7a81b (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.cpp | 13 |
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(); |