From 36385a4b56975756a1ceb55ce29852f4d6fdb574 Mon Sep 17 00:00:00 2001 From: Albrecht Schlosser Date: Sat, 4 Apr 2015 16:21:52 +0000 Subject: 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 --- FL/Fl.H | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) 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); -- cgit v1.2.3