| [ Return to Bugs & Features | Roadmap 1.3 | SVN ⇄ GIT ]
STR #3212
Application: | FLTK Library |
Status: | 1 - Closed w/Resolution |
Priority: | 4 - High, e.g. key functionality not working |
Scope: | 3 - Applies to all machines and operating systems |
Subsystem: | Core Library |
Summary: | New FL_*_VERSION macros and Fl::*_version() methods. |
Version: | 1.3-current |
Created By: | AlbrechtS |
Assigned To: | AlbrechtS |
Fix Version: | 1.3.4 (SVN: v10712) |
Update Notification: | |
Trouble Report Files:
Trouble Report Comments:
|
#1 | AlbrechtS 07:25 Mar 27, 2015 |
| There have been discussions about runtime checking of FLTK's abi version in fltk.coredev recently (thread: "RFC: ABI version checker").
Currently we have FL_VERSION (and FL_MAJOR_VERSION, FL_MINOR_VERSION, and FL_PATCH_VERSION) and the static method Fl::version().
To provide the basics we need reliable compiler macros and a library method that provides the compiled-in FLTK ABI version. In a second step we should make the ABI version configurable w/o editing FL/Enumerations.H, i.e. using configure and/or CMake (see STR #3161 for a proposal).
The attached patch provides the compiler macros and static methods:
(1) Adds FL_ABI_VERSION and Fl::abi_version() in int format. FL_ABI_VERSION replaces FLTK_ABI_VERSION for consistency reasons, but FLTK_ABI_VERSION is retained for compatibility. Starting with FLTK 1.4 only FL_ABI_VERSION should be used.
(2) Unfortunately FL_VERSION and Fl::version() are both in floating point format which is not well suited for comparisons and not compatible with the format of FL_ABI_VERSION and Fl::abi_version(). Therefore this patch adds the macro FL_API_VERSION and the static method Fl::api_version() which is "the same" as FL_VERSION and Fl::version(), but in int format like FL(TK)_ABI_VERSION. With these new macros and methods we have for instance:
FLTK Version FL_API_VERSION FL_ABI_VERSION FL_VERSION (deprecated) 1.3.0 10300 10300 1.0300 1.3.4 10304 10300 1.0304
With these additions FL_VERSION and Fl::version() can be considered deprecated, but should be retained "forever".
(3) This patch also provides a new compiler macro named "WITH_ABI_VERSION" which replaces the deprecated "FLTK_ABI_VERSION". The new macro is intended to be used in configure/CMake as the intended FLTK ABI VERSION. This would be configured like:
./configure --with-abi-version=10305
similar to what is proposed in STR #3161. This configured/intended ABI version is range-checked in the patch to limit the macro FL_ABI_VERSION between patch version 0 and the current patch version, for instance
FLTK 1.3.4: 10300 <= FL_ABI_VERSION <= FL_API_VERSION == 10304
This ensures that the built library always has a correct ABI version. | |
|
#2 | AlbrechtS 07:34 Mar 27, 2015 |
| I set the priority of this STR to 4 (high), although this is formally a RFE. I believe that this is a very useful improvement, and it is a prerequisite for a valid ABI check as proposed in fltk.coredev by Greg and for making the ABI version configurable as proposed in STR #3161.
Therefore this should be included in FLTK 1.3.4.
@devs: please comment and/or vote. Of course the names of the macros and methods are not final, so please feel free to propose name changes.
I'll post a message in fltk.coredev (above mentioned thread). If there is need for further discussions this might be the right place. | |
|
#3 | AlbrechtS 05:54 Mar 30, 2015 |
| Attached file abi_version_v2.patch removes the additional macro WITH_ABI_VERSION in favor of defining FL_ABI_VERSION directly, as suggested by Manolo.
Note that there are some comments included about "work in progress". These are intentional and will be removed when the configure/CMake updates will be done.
I consider this "ready" now, and I'm going to commit this patch if there are no objections. | |
|
#4 | AlbrechtS 05:57 Mar 30, 2015 |
| I'm uploading my test file "versions.cxx".
Should we add this to the test/ folder? Or examples/ folder? | |
|
#5 | AlbrechtS 09:35 Apr 04, 2015 |
| Fixed in Subversion repository.
I committed abi_version_v2.patch with a few corrections in svn r 10673.
I also added Fl::abi_check() as discussed in fltk.coredev (svn r 10674). | |
|
#6 | AlbrechtS 06:09 Apr 21, 2015 |
| Fixed in Subversion repository.
Summary of changes:
r10673 | Add FL_ABI_VERSION, FL_API_VERSION, Fl::abi_version(), and Fl::api_version(). r10674 | Add Fl::abi_check() method to test if the runtime ABI version is correct. r10712 | Add FLTK version test program examples/fltk-versions.cxx. | |
|
#7 | greg.ercolano 22:06 Apr 21, 2015 |
| Just checking: should mods be made to the CMP for this? i.e. docs for devs and for mods during release procedure. | |
|
#8 | AlbrechtS 03:35 Apr 22, 2015 |
| I don't think so. The FLTK_ABI_VERSION guard macro is still in place and will be until FLTK 1.4.0 is released.
The configure/CMake update I'm working on (STR #3161) will not change this either, but may need some docs on how to configure or set up CMake to enable a different ABI version.
We can _opt_ for changing the docs by replacing FLTK_ABI_VERSION with FL_ABI_VERSION after 1.3.4 is released and the online docs reflect the fact the FL_ABI_VERSION is the new macro to be changed (by configure or CMake). However, in the code FLTK_ABI_VERSION will still be used (I'm not keen on changing the code - that's why both macros coexist in 1.3.x). Hence I believe the best time to change the CMP is while we're working on the 1.4.0 release. | |
[ Return to Bugs & Features ]
|
| |