Compile time and runtime checks for library compatibility

This commit is contained in:
2008-01-31 21:47:39 +00:00
parent 897045c51c
commit 33b236523a
5 changed files with 199 additions and 30 deletions

View File

@ -138,21 +138,6 @@ int isoburn_initialize(char msg[1024], int flag);
int isoburn_is_compatible(int major, int minor, int micro, int flag);
/** These three release version numbers tell the revision of this header file
and of the API it describes. They are memorized by applications at build
time.
*/
#define isoburn_header_version_major 0
#define isoburn_header_version_minor 0
#define isoburn_header_version_micro 1
/** Note:
Above version numbers are also recorded in configure.ac because libtool
wants them as parameters at build time.
For the library compatibility check ISOBURN_*_VERSION in configure.ac
are not decisive. Only the three numbers above do matter.
*/
/** Obtain the three release version numbers of the library. These are the
numbers encountered by the application when linking with libisoburn,
i.e. possibly not before run time.
@ -174,6 +159,77 @@ int isoburn_is_compatible(int major, int minor, int micro, int flag);
*/
void isoburn_version(int *major, int *minor, int *micro);
/** The minimum version of libisofs to be used with this version of libisoburn
*/
#define isoburn_libisofs_req_major 0
#define isoburn_libisofs_req_minor 6
#define isoburn_libisofs_req_micro 1
/** The minimum version of libburn to be used with this version of libisoburn
*/
#define isoburn_libburn_req_major 0
#define isoburn_libburn_req_minor 4
#define isoburn_libburn_req_micro 2
/** These three release version numbers tell the revision of this header file
and of the API it describes. They are memorized by applications at build
time.
*/
#define isoburn_header_version_major 0
#define isoburn_header_version_minor 0
#define isoburn_header_version_micro 1
/** Note:
Above version numbers are also recorded in configure.ac because libtool
wants them as parameters at build time.
For the library compatibility check ISOBURN_*_VERSION in configure.ac
are not decisive. Only the three numbers above do matter.
*/
/** Usage discussion:
Some developers of the libburnia project have differing
opinions how to ensure the compatibility of libaries
and applications.
It is about whether to use at compile time and at runtime
the version numbers isoburn_header_version_* provided here.
Thomas Schmitt advises to use them.
Vreixo Formoso advises to use other means.
At compile time:
Vreixo Formoso advises to leave proper version matching
to properly programmed checks in the the application's
build system, which will eventually refuse compilation.
Thomas Schmitt advises to use the macros defined here
for comparison with the application's requirements of
library revisions and to eventually break compilation.
Both advises are combinable. I.e. be master of your
build system and have #if checks in the source code
of your application, nevertheless.
At runtime (via *_is_compatible()):
Vreixo Formoso advises to compare the application's
requirements of library revisions with the runtime
library. This is to allow runtime libraries which are
young enough for the application but too old for
the lib*.h files seen at compile time.
Thomas Schmitt advises to compare the header
revisions defined here with the runtime library.
This is to enforce a strictly monotonous chain
of revisions from app to header to library,
at the cost of excluding some older libraries.
These two advises are mutually exclusive.
For an implementation of the Thomas Schmitt approach,
see libisoburn/burn_wrap.c : isoburn_initialize()
*/
/** Aquire a target drive by its filesystem path resp. libburn persistent
address.