A.2  Support for 32-Bit Applications on 64-Bit Windows and Linux Platforms

By default, applications created using the 64-bit versions of WinDriver are 64-bit applications. Such applications are more efficient than 32-bit applications. However, you can also use the 64-bit WinDriver versions to create 32-bit applications that will run on the supported Windows and Linux 64-bit platforms [A.1].

In the following documentation, <WD64> signifies the path to a 64-bit WinDriver installation directory for your target operating system, and <WD32> signifies the path to a 32-bit WinDriver installation directory for the same operating system.

To create a 32-bit application for 64-bit Windows or Linux platforms, using the 64-bit version of WinDriver, do the following:

  1. Create a WinDriver application, as outlined in this manual (e.g., by generating code with DriverWizard, or using one of the WinDriver samples).
  2. Build the application with an appropriate 32-bit compiler for your target OS, using the following configuration:
    • Add a KERNEL_64BIT preprocessor definition to your project or makefile.

      In the makefiles, the definition is added using the -D flag: -DKERNEL_64BIT.

      The sample and wizard-generated Linux makefiles and Windows MS Visual Studio projects, in the 64-bit WinDriver toolkit, already add this definition.

    • Link the application with the specific version of the WinDriver API library/shared object for 32-bit applications executed on 64-bit platforms – <WD64>\lib\amd64\x86\wdapi1021.lib on Windows <WD64>/lib/libwdapi1021_32.so on Linux.

      On Linux, the installation of the 64-bit WinDriver toolkit on the development machine creates a libwdapi1021.so symbolic link in the /usr/lib directory – which links to <WD64>/lib/libwdapi1021_32.so – and in the /usr/lib64 directory – which links to <WD64>/lib/libwdapi1021.so (the 64-bit version of this shared object).
      The sample and wizard-generated WinDriver makefiles rely on these symbolic links to link with the appropriate shared object, depending on whether the code is compiled using a 32-bit or 64-bit compiler.

      On Windows, the sample and wizard-generated MS Visual Studio projects are defined to link with wdapi1021.lib (see the AdditionalDependencies), but the linker library path refers to the 64-bit library file in the <WD64>\lib\amd64 directory (see AdditionalLibraryDirectories); when using such a project to compile a 32-bit application for 64-bit platforms, add \x86 to the library path in order to link the code with <WD64>\lib\amd64\x86\wdapi1021.lib.

  • When distributing your application to target 64-bit platforms, you need to provide with it the WinDriver API DLL/shared object for 32-bit applications executed on 64-bit platforms – <WD64>\redist\wdapi1021_32.dll on Windows <WD64>/lib/libwdapi1021_32.so on Linux. Before distributing this file, rename the copy of the file in your distribution package by removing the _32 portion. The installation on the target should copy the renamed DLL/shared object to the relevant OS directory – \windir\sysWOW64 on Windows or /usr/lib on Linux. All other distribution files are the same as for any other 64-bit WinDriver driver distribution, as detailed in chapter 11.
  • An application created using the method described in this section will not work on 32-bit platforms. A WinDriver application for 32-bit platforms needs to be compiled without the KERNEL_64BIT definition; it needs to be linked with the standard 32-bit version of the WinDriver API library/shared object from the 32-bit WinDriver installation (<WD32>\lib\x86\wdapi1021.lib on Windows / <WD32>/lib/libwdapi1021.so on Linux); and it should be distributed with the standard 32-bit WinDriver API DLL/shared object (<WD32>\redist\wdapi1021.dll on Windows / <WD32>/lib/libwdapi1021.so on Linux) and any other required 32-bit distribution file, as outlined in Chapter 11.