From 06dbe9a68cf09213e1b63fecf8a91fe386508c63 Mon Sep 17 00:00:00 2001 From: lloyd Date: Wed, 28 Jul 2010 04:34:57 +0000 Subject: 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. --- src/engine/dyn_engine/dyn_engine.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) 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("create_engine"); + module_version version = + lib->resolve("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("create_engine"); engine = creator(); -- cgit v1.2.3