This article describes special build modes that allow greater compatibility with OWL. These modes should be used only when porting old code from OWL to OWLNext. After completing the migration, it is recommended that compatibility build modes are turned off, and that your code is adapted to the latest changes in OWLNext.
For our recommended upgrade approach, see Upgrading from OWL.
Note: The compatibility modes were altogether removed in OWLNext 8, and the rest of this article hence only applies to version 7 and earlier.
Pass "COMPAT=5" to the make file when building the libraries. For example, the following command on a Visual Studio Command Prompt builds the static debug variant of the OWLNext core with enhanced OWL 5 compatibility:
cd %OWLROOT%\source\owlcore
nmake -f vc.mak DEBUG=1 COMPAT=5
If you use OWLMaker, you just select the compatibility mode "OWL 5 API" on the modules page of the OWLMaker Wizard.
When "COMPAT=5" is passed to the make file, the macro OWL5_COMPAT will be defined in the arguments passed to the compiler, i.e. "/D OWL5_COMPAT". In turn, the OWLNext source code has conditional code that checks for the definition of OWL5_COMPAT, and if defined, enables greater compatibility with OWL 5 in many places.
To use the OWL 5 compatibility mode in your application, you have to add OWL5_COMPAT to the preprocessor definitions in the project settings in your IDE, or pass "/D OWL5_COMPAT" explicitly to the compiler, if you use command-line tools. OWLNext uses auto-linking, so you should not have to specify the library variant to link explicitly.
Note: To avoid link conflicts, OWLNext library variants built with OWL5_COMPAT will have the number 5 embedded in the last part of the library name. For example, for the x86-static-debug variant of OWLNext 6.34, built for Visual Studio 2013, the core library name will be "owl-6.34-v12-x86-5dt.lib". For more information, see the OWLNext Library Files Naming Convention.
OWLNext is based on OWL 5, and since OWLNext 6.32, the build modes OWL1_COMPAT and OWL2_COMPAT are no longer available. Before migrating your code to OWLNext you should make sure it works well with OWL 5. If you have code based on OWL version 1 or 2, you need to upgrade to OWL 5 before moving to OWLNext. See Upgrading from OWL 1.0.
Since version 8, there are no compatibility modes in OWLNext. So, if you are upgrading from OWL, you should use an earlier version of OWLNext as a stepping stone. See Upgrading from OWL | Recommended step-by-step approach.
Search the the OWLNext source code for the string "OWL5_COMPAT" to get a complete picture of the effects of enabling this build mode. The following sections give an overview of important changes.
The core of OWLNext now lives in the "owl" namespace. OWLNext 6.32 renamed the namespace from "OWL" to "owl". A macro for the old namespace name is available in OWL5_COMPAT mode. However, note that OWLNext is strict about namespaces, whether or not you enable compatibility mode. See FAQ for some tips on how to update your code.
OWLNext 6.40 introduced a major overhaul of the message dispatch machinery, including a new data structure for response tables.
In OWL5_COMPAT mode, the old data structure is reinstated, as well as the obsolete types and macros. However, the old implementation is deprecated, so you should not rely on it, as this compatibility may be removed in the future. If your code depends on the old implementation, you should update it.
See Windows Message Dispatch in OWLNext for more information about the new implementation.
In OWL 5, the dialog data transfer function TWindow::TransferData is called at the end of TWindow::SetupWindow. This is unfortunate because SetupWindow is commonly overridden to do custom initialisation of the window. However, if the override calls TWindow::SetupWindow, as is the common idiom, then data is transferred before the custom initialisation can take place. This calling sequence problem has been fixed, so that TransferData is now called after the call to SetupWindow (i.e. not within). See bug ticket "TransferData called before complete setup" [bugs:#102].
In OWL5_COMPAT mode, the old (erroneous) calling sequence is reinstated. Make sure you check your code for dependency on this calling sequence, before turning the compatibility mode off.
For safety, the constructors for these classes are now explicit
, and the classes are non-copyable. In OWL5_COMPAT mode these changes are reverted. Rewrite your code to use std::unique_ptr instead.
The following (possibly incomplete) list of functions have had their signature changed in OWLNext, due to const-correctness issues etc. In OWL5_COMPAT mode, the old signature is reinstated. You should upgrade your code to use the new signatures.
Note: Beware of changes to the signature of virtual functions. If you use the wrong signature in your override, you may inadvertently and silently create a new virtual function, rather than override the base. To guard against this problem it is recommended to use the override
keyword (introduced in C++11).
int
and takes int
buffer size.int
.uint modifiers
and uint vk
.uint size
. It also has new overload templates that infer the buffer size from the argument type. See Safe Transfer Buffers.The following classes and members are obsolete, but are reinstated in OWL5_COMPAT mode:
The following messages are obsolete, but are reinstated in OWL5_COMPAT mode:
The following legacy libraries are obsolete and no longer supported by default. In OWL5_COMPAT mode, the support is reinstated.
The following legacy libraries are deprecated and since OWLNext 7 no longer supported by default. In OWL5_COMPAT mode, the support is reinstated.
Bugs: #102
Bugs: #342
Discussion: Upgrading from OWL: MDIClients in multiple DLL's
Discussion: User Guide: Upgrade to OWLNext with ease (documentation, tips, FAQ, etc.)
Discussion: OWL 5 Compatibility
Discussion: Can I upgrade OWLNext 6.30 to Visual Studio 2019?
Discussion: Porting my codes to OWLNext 6.42
Feature Requests: #236
News: 2015/05/owlnext-642-release-and-6345-update
Wiki: Frequently_Asked_Questions
Wiki: Knowledge_Base
Wiki: OWLMaker
Wiki: OWLNext_naming_convention
Wiki: Upgrading_from_OWL