2008-02-18 19:04:03 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
2008-02-21 16:46:03 -05:00
|
|
|
// Name: backwardcompatibility.h
|
2008-02-18 19:04:03 -05:00
|
|
|
// Purpose: topic overview
|
|
|
|
// Author: wxWidgets team
|
2010-07-13 09:29:13 -04:00
|
|
|
// Licence: wxWindows licence
|
2008-02-18 19:04:03 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2008-03-12 04:50:42 -04:00
|
|
|
/**
|
2008-02-19 08:28:24 -05:00
|
|
|
|
2008-03-12 04:50:42 -04:00
|
|
|
@page overview_backwardcompat Backwards Compatibility
|
2008-02-19 08:28:24 -05:00
|
|
|
|
2012-11-03 14:29:28 -04:00
|
|
|
@tableofcontents
|
|
|
|
|
2022-11-01 13:18:31 -04:00
|
|
|
The goal of wxWidgets is not only to provide a consistent programming
|
2008-03-12 04:50:42 -04:00
|
|
|
interface across many platforms, but also to provide an interface that is
|
2022-11-01 13:18:31 -04:00
|
|
|
reasonably stable over time.
|
2008-02-19 08:28:24 -05:00
|
|
|
|
|
|
|
|
2008-02-21 16:46:03 -05:00
|
|
|
|
2008-03-12 04:50:42 -04:00
|
|
|
@section overview_backwardcompat_versionnumbering The Version Numbering Scheme
|
2008-02-19 08:28:24 -05:00
|
|
|
|
2008-03-12 04:50:42 -04:00
|
|
|
wxWidgets version numbers can have up to four components, with trailing zeros
|
|
|
|
sometimes omitted:
|
2008-02-19 08:28:24 -05:00
|
|
|
|
2008-03-14 19:59:55 -04:00
|
|
|
@verbatim
|
2008-03-12 04:50:42 -04:00
|
|
|
major.minor.release.sub-release
|
|
|
|
@endverbatim
|
2008-02-19 08:28:24 -05:00
|
|
|
|
2008-03-12 04:50:42 -04:00
|
|
|
A stable release of wxWidgets will have an even number for @e minor, e.g.
|
2022-11-01 13:18:31 -04:00
|
|
|
3.2.0. Stable, in this context, means that the API is not changing. In truth,
|
2008-03-12 04:50:42 -04:00
|
|
|
some changes are permitted, but only those that are backward compatible. For
|
2022-11-01 13:18:31 -04:00
|
|
|
example, you can expect later 3.2.x releases, such as 3.2.1 and 3.2.2 to be
|
2008-03-12 04:50:42 -04:00
|
|
|
backward compatible with their predecessor.
|
2008-02-21 16:46:03 -05:00
|
|
|
|
2008-03-12 04:50:42 -04:00
|
|
|
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 @e minor, for
|
2022-11-01 13:18:31 -04:00
|
|
|
example 3.3.x. Releases from this branch are known as development snapshots.
|
2008-02-21 16:46:03 -05:00
|
|
|
|
2008-03-12 04:50:42 -04:00
|
|
|
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
|
2022-11-01 13:18:31 -04:00
|
|
|
example: 3.4.0. And the process begins again. This is how the tension between
|
2008-03-12 04:50:42 -04:00
|
|
|
keeping the interface stable, and allowing the library to evolve is managed.
|
2008-02-21 16:46:03 -05:00
|
|
|
|
2008-03-12 04:50:42 -04:00
|
|
|
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.
|
2008-02-19 08:28:24 -05:00
|
|
|
|
2008-02-21 16:46:03 -05:00
|
|
|
|
2008-03-12 04:50:42 -04:00
|
|
|
@section overview_backwardcompat_sourcecompat Source Level Compatibility
|
2008-02-19 08:28:24 -05:00
|
|
|
|
2008-03-12 04:50:42 -04:00
|
|
|
Later releases from a stable branch are backward compatible with earlier
|
|
|
|
releases from the same branch at the source level. This means that, for
|
2022-11-01 13:18:31 -04:00
|
|
|
example, if you develop your application using wxWidgets 3.2.0 then it should
|
|
|
|
also compile fine with all later 3.2.x versions.
|
2008-02-21 16:46:03 -05:00
|
|
|
|
2008-03-12 04:50:42 -04:00
|
|
|
The converse is also true providing you avoid any new features not present in
|
2022-11-01 13:18:31 -04:00
|
|
|
the earlier version. For example if you develop using 3.3.1 your program will
|
|
|
|
compile fine with wxWidgets 3.2.0 providing you don't use any 3.3.1 specific
|
2008-03-12 04:50:42 -04:00
|
|
|
features.
|
2008-02-21 16:46:03 -05:00
|
|
|
|
2008-03-12 04:50:42 -04:00
|
|
|
For some platforms binary compatibility is also supported, see
|
|
|
|
@ref overview_backwardcompat_libbincompat below.
|
2008-02-21 16:46:03 -05:00
|
|
|
|
2022-11-01 13:18:31 -04:00
|
|
|
Between minor versions, for example between 2.8.x, 3.0.x and 3.2.x, there will
|
2008-03-12 04:50:42 -04:00
|
|
|
be some incompatibilities. Wherever possible the old way of doing something is
|
|
|
|
kept alongside the new for a time wrapped inside:
|
2008-02-19 08:28:24 -05:00
|
|
|
|
2008-03-12 04:50:42 -04:00
|
|
|
@code
|
2022-11-01 13:18:31 -04:00
|
|
|
#if WXWIN_COMPATIBILITY_3_0
|
2008-02-21 16:46:03 -05:00
|
|
|
// deprecated feature
|
|
|
|
...
|
2008-03-12 04:50:42 -04:00
|
|
|
#endif
|
|
|
|
@endcode
|
|
|
|
|
|
|
|
By default the @c WXWIN_COMPATIBILITY_X_X macro is set to 1 for the previous
|
2022-11-01 13:18:31 -04:00
|
|
|
stable branch, for example in 3.2.x, @c WXWIN_COMPATIBILITY_3_0 = 1. For the
|
|
|
|
next earlier stable branch the default is 0, so @c WXWIN_COMPATIBILITY_2_8 = 0
|
|
|
|
for 3.2.x. Earlier than that, obsolete features are removed.
|
2008-03-12 04:50:42 -04:00
|
|
|
|
|
|
|
These macros can be changed in @c setup.h. Or on UNIX-like systems you can set
|
2022-11-01 13:18:31 -04:00
|
|
|
them using the @c \--disable-compat30 and @c \--enable-compat28 options to
|
|
|
|
configure. Their values can also be changed with CMake.
|
2008-03-12 04:50:42 -04:00
|
|
|
|
|
|
|
They can be useful in two ways:
|
|
|
|
|
2022-11-01 13:18:31 -04:00
|
|
|
@li Changing @c WXWIN_COMPATIBILITY_3_0 to 0 can be useful to find uses of
|
2008-03-12 04:50:42 -04:00
|
|
|
deprecated features in your program that should eventually be removed.
|
2022-11-01 13:18:31 -04:00
|
|
|
@li Changing @c WXWIN_COMPATIBILITY_2_8 to 1 can be useful to compile a program
|
|
|
|
developed using 2.8.x that no longer compiles with 3.2.x.
|
2008-03-12 04:50:42 -04:00
|
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
|
|
|
|
@section overview_backwardcompat_libbincompat Library Binary Compatibility
|
|
|
|
|
|
|
|
For 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
|
2020-07-04 16:08:24 -04:00
|
|
|
dynamic shared libraries on macOS.
|
2008-03-12 04:50:42 -04:00
|
|
|
|
|
|
|
For example, suppose several applications are installed on a system requiring
|
2022-11-01 13:18:31 -04:00
|
|
|
wxWidgets 3.2.0, 3.2.1 and 3.2.2. Since 3.2.2 is backward compatible with the
|
|
|
|
earlier versions, it should be enough to install just wxWidgets 3.2.2 shared
|
2008-03-12 04:50:42 -04:00
|
|
|
libraries, and all the applications should be able to use them. If binary
|
2022-11-01 13:18:31 -04:00
|
|
|
compatibility is not supported, then all the required versions 3.2.0, 3.2.1 and
|
|
|
|
3.2.2 must be installed side by side.
|
2008-03-12 04:50:42 -04:00
|
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
|
|
|
|
@section overview_backwardcompat_appbincompat Application Binary Compatibility
|
|
|
|
|
|
|
|
The most important aspect of binary compatibility is that applications compiled
|
2022-11-01 13:18:31 -04:00
|
|
|
with one version of wxWidgets, e.g. 3.2.1, continue to work with shared
|
|
|
|
libraries of a later binary compatible version, for example 3.2.2. The converse
|
2008-03-12 04:50:42 -04:00
|
|
|
can also be useful however. That is, it can be useful for a developer using a
|
2022-11-01 13:18:31 -04:00
|
|
|
later version, e.g. 3.2.2 to be able to create binary application packages that
|
2008-03-12 04:50:42 -04:00
|
|
|
will work with all binary compatible versions of the shared library starting
|
2022-11-01 13:18:31 -04:00
|
|
|
with, for example 3.2.0.
|
2008-03-12 04:50:42 -04:00
|
|
|
|
|
|
|
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 @c 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
|
2022-11-01 13:18:31 -04:00
|
|
|
component, for example @c wxABI_VERSION=30200 for 3.2.0.
|
2008-03-12 04:50:42 -04:00
|
|
|
|
|
|
|
Setting @c 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 @c 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
|
2022-11-01 13:18:31 -04:00
|
|
|
numbers. It won't, for example, help you write code compatible with 3.0.x using
|
|
|
|
wxWidgets 3.2.x.
|
2008-02-21 16:46:03 -05:00
|
|
|
|
|
|
|
*/
|