backwardcompatibility.h 7.7 KB

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