summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlbrecht Schlosser <albrechts.fltk@online.de>2015-04-04 16:21:52 +0000
committerAlbrecht Schlosser <albrechts.fltk@online.de>2015-04-04 16:21:52 +0000
commit36385a4b56975756a1ceb55ce29852f4d6fdb574 (patch)
treea8dd0f69fb11cb5a1f96009ed7712378a8922c9e
parent94ddbc199577885bd998d1f9e95692da391fc907 (diff)
Add Fl::abi_check() method to test if the runtime ABI version is correct.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10674 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
-rw-r--r--FL/Fl.H26
1 files changed, 26 insertions, 0 deletions
diff --git a/FL/Fl.H b/FL/Fl.H
index 0e6e83e3e..8941c29e4 100644
--- a/FL/Fl.H
+++ b/FL/Fl.H
@@ -268,6 +268,32 @@ public:
// ABI version number
static int abi_version();
+ /*
+ Returns whether the runtime library ABI version is correct.
+
+ This enables you to check the ABI version of the linked FLTK
+ library at runtime.
+
+ Returns 1 (true) if the compiled ABI version (in the header files)
+ and the linked library ABI version (used at runtime) are the same,
+ 0 (false) otherwise.
+
+ Argument \p val can be used to query a particular library ABI version.
+ Use for instance 10303 to query if the runtime library is compatible
+ with FLTK ABI version 1.3.3. This is rarely useful.
+
+ The default \val argument is FL_ABI_VERSION, which checks the version
+ defined at configure time (i.e. in the header files at program
+ compilation time) against the linked library version used at runtime.
+ This is particularly useful if you linked with a shared object library,
+ but it also concerns static linking.
+
+ \see Fl::abi_version()
+ */
+ static inline int abi_check(const int val = FL_ABI_VERSION) {
+ return val == abi_version();
+ }
+
// argument parsers:
static int arg(int argc, char **argv, int& i);
static int args(int argc, char **argv, int& i, Fl_Args_Handler cb = 0);