]> git.saurik.com Git - wxWidgets.git/blame - docs/doxygen/overviews/backwardcompatibility.h
Fix broken and missing DataView interface items for Phoenix
[wxWidgets.git] / docs / doxygen / overviews / backwardcompatibility.h
CommitLineData
15b6757b 1/////////////////////////////////////////////////////////////////////////////
e0a47918 2// Name: backwardcompatibility.h
15b6757b
FM
3// Purpose: topic overview
4// Author: wxWidgets team
5// RCS-ID: $Id$
526954c5 6// Licence: wxWindows licence
15b6757b
FM
7/////////////////////////////////////////////////////////////////////////////
8
880efa2a 9/**
36c9828f 10
880efa2a 11@page overview_backwardcompat Backwards Compatibility
36c9828f 12
e7054054
BP
13@tableofcontents
14
880efa2a
BP
15Many of the GUIs and platforms supported by wxWidgets are continuously
16evolving, and some of the new platforms wxWidgets now supports were quite
17unimaginable even a few years ago. In this environment wxWidgets must also
18evolve in order to support these new features and platforms.
e0a47918 19
880efa2a
BP
20However the goal of wxWidgets is not only to provide a consistent programming
21interface across many platforms, but also to provide an interface that is
22reasonably stable over time, to help protect its users from some of the
23uncertainty of the future.
36c9828f
FM
24
25
e0a47918 26
880efa2a 27@section overview_backwardcompat_versionnumbering The Version Numbering Scheme
36c9828f 28
880efa2a
BP
29wxWidgets version numbers can have up to four components, with trailing zeros
30sometimes omitted:
36c9828f 31
adcb6f88 32@verbatim
880efa2a
BP
33major.minor.release.sub-release
34@endverbatim
36c9828f 35
880efa2a
BP
36A stable release of wxWidgets will have an even number for @e minor, e.g.
372.6.0. Stable, in this context, means that the API is not changing. In truth,
38some changes are permitted, but only those that are backward compatible. For
39example, you can expect later 2.6.x releases, such as 2.6.1 and 2.6.2 to be
40backward compatible with their predecessor.
e0a47918 41
880efa2a
BP
42When it becomes necessary to make changes which are not wholly backward
43compatible, the stable branch is forked, creating a new development branch of
44wxWidgets. This development branch will have an odd number for @e minor, for
45example 2.7.x. Releases from this branch are known as development snapshots.
e0a47918 46
880efa2a
BP
47The stable branch and the development branch will then be developed in parallel
48for some time. When it is no longer useful to continue developing the stable
49branch, the development branch is renamed and becomes a new stable branch, for
50example: 2.8.0. And the process begins again. This is how the tension between
51keeping the interface stable, and allowing the library to evolve is managed.
e0a47918 52
880efa2a
BP
53You can expect the versions with the same major and even minor version number
54to be compatible, but between minor versions there will be incompatibilities.
55Compatibility is not broken gratuitously however, so many applications will
56require no changes or only small changes to work with the new version.
36c9828f 57
e0a47918 58
880efa2a 59@section overview_backwardcompat_sourcecompat Source Level Compatibility
36c9828f 60
880efa2a
BP
61Later releases from a stable branch are backward compatible with earlier
62releases from the same branch at the source level. This means that, for
63example, if you develop your application using wxWidgets 2.8.0 then it should
64also compile fine with all later 2.8.x versions.
e0a47918 65
880efa2a
BP
66The converse is also true providing you avoid any new features not present in
67the earlier version. For example if you develop using 2.6.1 your program will
68compile fine with wxWidgets 2.8.0 providing you don't use any 2.8.1 specific
69features.
e0a47918 70
880efa2a
BP
71For some platforms binary compatibility is also supported, see
72@ref overview_backwardcompat_libbincompat below.
e0a47918 73
880efa2a
BP
74Between minor versions, for example between 2.4.x, 2.6.x and 2.8.x, there will
75be some incompatibilities. Wherever possible the old way of doing something is
76kept alongside the new for a time wrapped inside:
36c9828f 77
880efa2a
BP
78@code
79#if WXWIN_COMPATIBILITY_2_6
e0a47918
FM
80 // deprecated feature
81 ...
880efa2a
BP
82#endif
83@endcode
84
85By default the @c WXWIN_COMPATIBILITY_X_X macro is set to 1 for the previous
86stable branch, for example in 2.8.x, @c WXWIN_COMPATIBILITY_2_6 = 1. For the
87next earlier stable branch the default is 0, so @c WXWIN_COMPATIBILITY_2_4 = 0
88for 2.8.x. Earlier than that, obsolete features are removed.
89
90These macros can be changed in @c setup.h. Or on UNIX-like systems you can set
91them using the @c --disable-compat26 and @c --enable-compat24 options to
92configure.
93
94They can be useful in two ways:
95
96@li Changing @c WXWIN_COMPATIBILITY_2_6 to 0 can be useful to find uses of
97 deprecated features in your program that should eventually be removed.
98@li Changing @c WXWIN_COMPATIBILITY_2_4 to 1 can be useful to compile a program
99 developed using 2.4.x that no longer compiles with 2.8.x.
100
101A program requiring one of these macros to be 1 will become incompatible with
102some future version of wxWidgets, and you should consider updating it.
103
104
105@section overview_backwardcompat_libbincompat Library Binary Compatibility
106
107For some platforms, releases from a stable branch are not only source level
108compatible but can also be binary compatible.
109
110Binary compatibility makes it possible to get the maximum benefit from using
111shared libraries, also known as dynamic link libraries (DLLs) on Windows or
112dynamic shared libraries on OS X.
113
114For example, suppose several applications are installed on a system requiring
115wxWidgets 2.6.0, 2.6.1 and 2.6.2. Since 2.6.2 is backward compatible with the
116earlier versions, it should be enough to install just wxWidgets 2.6.2 shared
117libraries, and all the applications should be able to use them. If binary
118compatibility is not supported, then all the required versions 2.6.0, 2.6.1 and
1192.6.2 must be installed side by side.
120
121Achieving this, without the user being required to have the source code and
122recompile everything, places many extra constraints on the changes that can be
123made within the stable branch. So it is not supported for all platforms, and
124not for all versions of wxWidgets. To date it has mainly been supported by
125wxGTK for UNIX-like platforms.
126
127Another practical consideration is that for binary compatibility to work, all
128the applications and libraries must have been compiled with compilers that are
129capable of producing compatible code; that is, they must use the same ABI
130(Application Binary Interface). Unfortunately most different C++ compilers do
131not produce code compatible with each other, and often even different versions
132of the same compiler are not compatible.
133
134
135@section overview_backwardcompat_appbincompat Application Binary Compatibility
136
137The most important aspect of binary compatibility is that applications compiled
138with one version of wxWidgets, e.g. 2.6.1, continue to work with shared
139libraries of a later binary compatible version, for example 2.6.2. The converse
140can also be useful however. That is, it can be useful for a developer using a
141later version, e.g. 2.6.2 to be able to create binary application packages that
142will work with all binary compatible versions of the shared library starting
143with, for example 2.6.0.
144
145To do this the developer must, of course, avoid any features not available in
146the earlier versions. However this is not necessarily enough; in some cases an
147application compiled with a later version may depend on it even though the same
148code would compile fine against an earlier version.
149
150To help with this, a preprocessor symbol @c wxABI_VERSION can be defined during
151the compilation of the application (this would usually be done in the
152application's makefile or project settings). It should be set to the lowest
153version that is being targeted, as a number with two decimal digits for each
154component, for example @c wxABI_VERSION=20600 for 2.6.0.
155
156Setting @c wxABI_VERSION should prevent the application from implicitly
157depending on a later version of wxWidgets, and also disables any new features
158in the API, giving a compile time check that the source is compatible with the
159versions of wxWidgets being targeted.
160
161Uses of @c wxABI_VERSION are stripped out of the wxWidgets sources when each
162new development branch is created. Therefore it is only useful to help achieve
163compatibility with earlier versions with the same major and even minor version
164numbers. It won't, for example, help you write code compatible with 2.6.x using
165wxWidgets 2.8.x.
e0a47918
FM
166
167*/