]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/backwardcompat.tex
Add *wxTopLevelWindowGTK*RequestUserAttention*int*;
[wxWidgets.git] / docs / latex / wx / backwardcompat.tex
CommitLineData
a61b8ecb
MW
1%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2%% Name: backwardcompat.tex
3%% Purpose: Explains how much and what kind of backward compatibility users
4%% can expect
5%% Author: M.J.Wetherell
6%% RCS-ID: $Id$
7%% Copyright: 2005 M.J.Wetherell
8%% License: wxWindows license
9%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10
11\chapter{Backward compatibility}\label{backwardcompatibility}
12\setheader{{\it CHAPTER \thechapter}}{}{}{}{}{{\it CHAPTER \thechapter}}%
13\setfooter{\thepage}{}{}{}{}{\thepage}%
14
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.
19
20However the goal of wxWidgets is not only to provide a consistent
21programming interface across many platforms, but also to provide an
22interface that is reasonably stable over time, to help protect its users
23from some of the uncertainty of the future.
24
25{\large {\bf The version numbering scheme}}\label{versionnumbering}
26
27wxWidgets version numbers can have up to four components, with trailing
28zeros sometimes omitted:
29
30\begin{verbatim}
31 major.minor.release.sub-release
32\end{verbatim}
33
34A {\em stable} release of wxWidgets will have an even number for {\tt
35minor}, e.g. {\tt 2.6.0}.
36
37Stable, in this context, means that the API is not changing. In truth, some
38changes are permitted, but only those that are backward compatible. For
39example, you can expect later {\tt 2.6.x.x} releases, such as {\tt 2.6.1}
40and {\tt 2.6.2} to be backward compatible with their predecessor.
41
42When it becomes necessary to make changes which are not wholly backward
43compatible, the stable branch is forked, creating a new {\em development}
44branch of wxWidgets. This development branch will have an odd number
45for {\tt minor}, for example {\tt 2.7.x.x}. Releases from this branch are
46known as {\em development snapshots}.
47
48The stable branch and the development branch will then be developed in
49parallel for some time. When it is no longer useful to continue developing
50the stable branch, the development branch is renamed and becomes a new
51stable branch, for example {\tt 2.8.0}. And the process begins again.
52
53This is how the tension between keeping the interface stable, and allowing
54the library to evolve is managed.
55
56You can expect the versions with the same major and {\em even} minor
57version number to be compatible, but between minor versions there will be
58incompatibilities. Compatibility is not broken gratuitously however, so
59many applications will require no changes or only small changes to work
60with the new version.
61
62{\large {\bf Source level compatibility}}\label{sourcecompatibility}
63
64Later releases from a stable branch are backward compatible with earlier
65releases from the same branch at the {\em source} level.
66
67This means that, for example, if you develop your application using
68wxWidgets {\tt 2.6.0} then it should also compile fine with all later {\tt
692.6.x} versions. The converse is also true providing you avoid any new
70features not present in the earlier version. For example if you develop
71using {\tt 2.6.1} your program will compile fine with wxWidgets {\tt 2.6.0}
72providing you don't use any {\tt 2.6.1} specific features.
73
74For some platforms binary compatibility is also supported, see 'Library
75binary compatibility' below.
76
77Between minor versions, for example between {\tt 2.2.x}, {\tt 2.4.x} and {\tt
782.6.x}, there will be some incompatibilities. Wherever possible the old way
79of doing something is kept alongside the new for a time wrapped inside:
80
81\begin{verbatim}
82 #if WXWIN_COMPATIBILITY_2_4
83 /* deprecated feature */
84 ...
85 #endif
86\end{verbatim}
87
88By default the {\tt WXWIN\_COMPATIBILITY{\it \_X\_X}} macro is set
89to 1 for the previous stable branch, for example
90in {\tt 2.6.x} {\tt WXWIN\_COMPATIBILITY\_2\_4 = 1}. For the next earlier
91stable branch the default is 0, so {\tt WXWIN\_COMPATIBILITY\_2\_2 = 0}
92for {\tt 2.6.x}. Earlier than that, obsolete features are removed.
93
94These macros can be changed in {\tt setup.h}. Or on UNIX-like systems you can
95set them using the {\tt --disable-compat24} and {\tt --enable-compat22}
96options to {\tt configure}.
97
98They can be useful in two ways:
99
100\begin{enumerate}
101\item Changing {\tt WXWIN\_COMPATIBILITY\_2\_4} to 0 can be useful to
102find uses of deprecated features in your program.
103\item Changing {\tt WXWIN\_COMPATIBILITY\_2\_2} to 1 can be useful to
104compile a program developed using {\tt 2.2.x} that no longer compiles
105with {\tt 2.6.x}.
106\end{enumerate}
107
108A program requiring one of these macros to be 1 will become
109incompatible with some future version of wxWidgets, and you should consider
110updating it.
111
112{\large {\bf Library binary compatibility}}\label{libbincompatibility}
113
114For some platforms, releases from a stable branch are not only source level
115compatible but can also be {\em binary compatible}.
116
117Binary compatibility makes it possible to get the maximum benefit from
118using shared libraries, also known as dynamic link libraries (DLLs) on
119Windows or dynamic shared libraries on OS X.
120
121For example, suppose several applications are installed on a system requiring
122wxWidgets {\tt 2.6.0}, {\tt 2.6.1} and {\tt 2.6.2}. Since {\tt 2.6.2} is
123backward compatible with the earlier versions, it should be enough to
124install just wxWidgets {\tt 2.6.2} shared libraries, and all the applications
125should be able to use them. If binary compatibility is not supported, then all
126the required versions {\tt 2.6.0}, {\tt 2.6.1} and {\tt 2.6.2} must be
127installed side by side.
128
5a31fc1a 129Achieving this, without the user being required to have the source code
a61b8ecb 130and recompile everything, places many extra constraints on the changes
5a31fc1a 131that can be made within the stable branch. So it is not supported for all
a61b8ecb
MW
132platforms, and not for all versions of wxWidgets. To date it has mainly
133been supported by wxGTK for UNIX-like platforms.
134
135Another practical consideration is that for binary compatibility to work,
136all the applications and libraries must have been compiled with compilers
137that are capable of producing compatible code; that is, they must use the
138same ABI (Application Binary Interface). Unfortunately most different C++
139compilers do not produce code compatible with each other, and often even
140different versions of the same compiler are not compatible.
141
142{\large {\bf Application binary compatibility}}\label{appbincompatibility}
143
144The most important aspect of binary compatibility is that applications
145compiled with one version of wxWidgets, e.g. {\tt 2.6.1}, continue to work
146with shared libraries of a later binary compatible version, for example {\tt
1472.6.2}.
148
149The converse can also be useful however. That is, it can be useful for a
150developer using a later version, e.g. {\tt 2.6.2} to be able to create binary
151application packages that will work with all binary compatible versions of
152the shared library starting with, for example {\tt 2.6.0}.
153
154To do this the developer must, of course, avoid any features not available
155in the earlier versions. However this is not necessarily enough; in some
156cases an application compiled with a later version may depend on it even
157though the same code would compile fine against an earlier version.
158% thinks: a situation we should try to avoid.
159
160To help with this, a preprocessor symbol {\tt wxABI\_VERSION} can be defined
161during the compilation of the application (this would usually be done in the
162application's makefile or project settings). It should be set to the lowest
163version that is being targeted, as a number with two decimal digits for each
164component, for example {\tt wxABI\_VERSION=20600} for {\tt 2.6.0}.
165
166Setting {\tt wxABI\_VERSION} should prevent the application from implicitly
167depending on a later version of wxWidgets, and also disables any new features
168in the API, giving a compile time check that the source is compatible with
169the versions of wxWidgets being targeted.
170
171Uses of {\tt wxABI\_VERSION} are stripped out of the wxWidgets sources when
172each new development branch is created. Therefore it is only useful to help
173achieve compatibility with earlier versions with the same major
174and {\em even} minor version numbers. It won't, for example, help you write
175code compatible with {\tt 2.4.x} using wxWidgets {\tt 2.6.x}.