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 and Windows GCC makefiles and the 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\wdapi1140.lib on Windows / <WD64>/lib/libwdapi1140_32.so on Linux.

      The sample and wizard-generated project and make files for 32-bit applications in the 64-bit WinDriver toolkit already link to the correct library:
      On Windows, the MS Visual Studio project files and Windows GCC makefiles are defined to link with <WD64>\lib\amd64\x86\wdapi1140.lib.
      On Linux, the installation of the 64-bit WinDriver toolkit on the development machine creates a libwdapi1140.so symbolic link in the /usr/lib directory — which links to <WD64>/lib/libwdapi1140_32.so — and in the /usr/lib64 directory — which links to <WD64>/lib/libwdapi1140.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.

  • 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\wdapi1140_32.dll on Windows / <WD64>/lib/libwdapi1140_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 14.
  • 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\wdapi1140.lib on Windows / <WD32>/lib/libwdapi1140.so on Linux); and it should be distributed with the standard 32-bit WinDriver API DLL/shared object (<WD32>\redist\wdapi1140.dll on Windows / <WD32>/lib/libwdapi1140.so on Linux) and any other required 32-bit distribution file, as outlined in Chapter 14.