backward compatibilitymany of the guis and platforms supported by wxwidgets are continuously evolving, and some of the new platforms wxwidgets now supports were quite unimaginable even a few years ago. in this environment wxwidgets must also evolve in order to support these new features and platforms. however the goal of wxwidgets is not only to provide a consistent programming interface across many platforms, but also to provide an interface that is reasonably stable over time, to help protect its users from some of the uncertainty of the future.
the version numbering scheme
the version numbering schemewxwidgets version numbers can have up to four components, with trailing zeros sometimes omitted:
major.minor.release.sub-releasea stable release of wxwidgets will have an even number for minor, e.g. 2.6.0. stable, in this context, means that the api is not changing. in truth, some changes are permitted, but only those that are backward compatible. for example, you can expect later 2.6.x.x releases, such as 2.6.1 and 2.6.2 to be backward compatible with their predecessor. when it becomes necessary to make changes which are not wholly backward compatible, the stable branch is forked, creating a new development branch of wxwidgets. this development branch will have an odd number for minor, for example 2.7.x.x. releases from this branch are known as development snapshots. the stable branch and the development branch will then be developed in parallel for some time. when it is no longer useful to continue developing the stable branch, the development branch is renamed and becomes a new stable branch, for example 2.8.0. and the process begins again. this is how the tension between keeping the interface stable, and allowing the library to evolve is managed. you can expect the versions with the same major and even minor version number to be compatible, but between minor versions there will be incompatibilities. compatibility is not broken gratuitously however, so many applications will require no changes or only small changes to work with the new version.
source level compatibilitylater releases from a stable branch are backward compatible with earlier releases from the same branch at the source level. this means that, for example, if you develop your application using wxwidgets 2.6.0 then it should also compile fine with all later 2.6.x versions. the converse is also true providing you avoid any new features not present in the earlier version. for example if you develop using 2.6.1 your program will compile fine with wxwidgets 2.6.0 providing you don't use any 2.6.1 specific features. for some platforms binary compatibility is also supported, see 'library binary compatibility' below. between minor versions, for example between 2.2.x, 2.4.x and 2.6.x, there will be some incompatibilities. wherever possible the old way of doing something is kept alongside the new for a time wrapped inside:
#if wxwin_compatibility_2_4 /* deprecated feature */ ... #endifby default the wxwin_compatibility_x_x macro is set to 1 for the previous stable branch, for example in 2.6.x wxwin_compatibility_2_4 = 1. for the next earlier stable branch the default is 0, so wxwin_compatibility_2_2 = 0 for 2.6.x. earlier than that, obsolete features are removed. these macros can be changed in setup.h. or on unix-like systems you can set them using the --disable-compat24 and --enable-compat22 options to configure. they can be useful in two ways:
a program requiring one of these macros to be 1 will become incompatible with some future version of wxwidgets, and you should consider updating it.
library binary compatibilityfor some platforms, releases from a stable branch are not only source level compatible but can also be binary compatible. binary compatibility makes it possible to get the maximum benefit from using shared libraries, also known as dynamic link libraries (dlls) on windows or dynamic shared libraries on os x. for example, suppose several applications are installed on a system requiring wxwidgets 2.6.0, 2.6.1 and 2.6.2. since 2.6.2 is backward compatible with the earlier versions, it should be enough to install just wxwidgets 2.6.2 shared libraries, and all the applications should be able to use them. if binary compatibility is not supported, then all the required versions 2.6.0, 2.6.1 and 2.6.2 must be installed side by side. achieving this, without the user being required to have the source code and recompile everything, places many extra constraints on the changes that can be made within the stable branch. so it is not supported for all platforms, and not for all versions of wxwidgets. to date it has mainly been supported by wxgtk for unix-like platforms. another practical consideration is that for binary compatibility to work, all the applications and libraries must have been compiled with compilers that are capable of producing compatible code; that is, they must use the same abi (application binary interface). unfortunately most different c++ compilers do not produce code compatible with each other, and often even different versions of the same compiler are not compatible.
application binary compatibilitythe most important aspect of binary compatibility is that applications compiled with one version of wxwidgets, e.g. 2.6.1, continue to work with shared libraries of a later binary compatible version, for example 2.6.2. the converse can also be useful however. that is, it can be useful for a developer using a later version, e.g. 2.6.2 to be able to create binary application packages that will work with all binary compatible versions of the shared library starting with, for example 2.6.0. to do this the developer must, of course, avoid any features not available in the earlier versions. however this is not necessarily enough; in some cases an application compiled with a later version may depend on it even though the same code would compile fine against an earlier version. to help with this, a preprocessor symbol wxabi_version can be defined during the compilation of the application (this would usually be done in the application's makefile or project settings). it should be set to the lowest version that is being targeted, as a number with two decimal digits for each component, for example wxabi_version=20600 for 2.6.0. setting wxabi_version should prevent the application from implicitly depending on a later version of wxwidgets, and also disables any new features in the api, giving a compile time check that the source is compatible with the versions of wxwidgets being targeted. uses of wxabi_version are stripped out of the wxwidgets sources when each new development branch is created. therefore it is only useful to help achieve compatibility with earlier versions with the same major and even minor version numbers. it won't, for example, help you write code compatible with 2.4.x using wxwidgets 2.6.x. |