WinDriver supports driver development for the following 64-bitarchitectures:

  • Windows AMD64 or Intel EM64T (x64)
  • Linux AMD64 or Intel EM64T (x86_64) or64-bit PowerPC (ppc64)

By default, applications created using the 64-bit versions of WinDriver are64-bit applications. Such applications are more efficient than 32-bitapplications. However, you can also use the 64-bit versions of WinDriver to create 32-bit applications that will run on the supported 64-bitplatforms. This document outlines two methods for creating such applications:

NOTE

In the following documentation

    • <WD64> signifies the path to a 64-bit WinDriver installation directory for your target operating system (e.g.,C:\WinDriver64), and <WD32> signifies the path to a32-bit WinDriver installation directory for the same operating system (e.g., C:\WinDriver).
  • <ver> signifies the version of the WinDriver installation that you are using — for example, 1200 for version 12.0.0.

Developing a 32-Bit WinDriver Application for 64-Bit Platforms

To create a 32-bit WinDriver application for 64-bit platforms, using a64-bit WinDriver installation, do the following:

    1. Create a WinDriver application, as outlined in the WinDriver User’s Manual — for example, by generating code with DriverWizard, or using one of the WinDriver samples.

 

  1. Build the application with an appropriate 32-bit compiler for your target operating system, using the following configuration:
      • Add the KERNEL_64BIT preprocessor definition.
        NOTE
        In the makefiles, the definition is added using the -Dflag: -DKERNEL_64BIT.

        The sample and wizard-generated Linux and Windows GCC makefiles and Windows MS Visual Studio projects, in the64-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\wdapi<ver>.lib on Windows (e.g.,C:\WinDriver64\lib\amd64\x86\wdapi1200.lib) /<WD64>/lib/libwdapi<ver>_32.so on Linux (e.g.,~/WinDriver64/lib/libwdapi1200_32.so).The sample and wizard-generated project and make files for32-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\wdapi1200.lib.
      On Linux, the installation of the 64-bit WinDriver toolkit on the development machine creates a libwdapi<ver>.sosymbolic link in the /usr/lib directory — which links to<WD64>/lib/libwdapi<ver>_32.so — and in the/usr/lib64 directory — which links to<WD64>/lib/libwdapi<ver>_32.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 a32-bit or 64-bit compiler.

NOTE

  • 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\wdapi<ver>_32.dll on Windows (e.g.,C:\WinDriver64\redist\wdapi1200_32.dll) /<WD64>/lib/libwdapi<ver>_32.so on Linux (e.g.,~/WinDriver64/lib/libwdapi1200_32.so).
    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-bitWinDriver driver distribution, as detailed in the WinDriver distribution instructions in the manuals.
  • An application created using this method will not work on32-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\wdapi<ver>.lib on Windows / <WD32>/lib/libwdapi<ver>.so on Linux); and it should be distributed with the standard 32-bit WinDriver-API DLL/shared object (<WD32>\redist\wdapi<ver>.dllon Windows / <WD32>/lib/libwdapi<ver>.so on Linux) and any other required 32-bit distribution file, as outlined in the WinDriver distribution instructions in the manuals.

Developing a 32-Bit Application for Both 32-Bit and 64-Bit Platforms

If you have both 64-bit and 32-bit WinDriver installations, you can also create a single 32-bit application that can be executed on both 32-bit and64-bit platforms. This can be done using the following method:

    1. Create a DLL (on Windows) or a shared object (on Linux) that concentrates the calls to the WinDriver APIs.
      If you created a WinDriver application using the generated DriverWizard code or one of the WinDriver samples, convert this application to a DLL/shared object.

      NOTE
      When using DriverWizard to generate PCI driver code for Windows MS Visual Studio, you have the option to generate the library code as a DLL (for both 32-bit and 64-bitenvironments).

 

    1. Compile two versions of your DLL/shared object:
      • A version for 32-bit platforms: This version should be compiled using a 32-bit compiler, without the KERNEL_64BITdefinition, and linked with the standard 32-bit WinDriver-API library/shared object from the 32-bit WinDriver installation — <WD32>\lib\x86\wdapi<ver>.lib on Windows (e.g.,C:\WinDriver\lib\x86\wdapi1200.lib) /<WD32>/lib/libwdapi<ver>.so on Linux (e.g.,~/WinDriver/lib/libwdapi1200.so).
      • A version for 64-bit platforms: This version should be compiled using a 32-bit compiler, with the KERNEL_64BITdefinition, and linked with the standard 32-bit WinDriver-API library/shared object from the 64-bit WinDriver installation — <WD64>\lib\amd64\x86\wdapi<ver>_32.lib on Windows (e.g.,C:\WinDriver64\lib\x86\wdapi1200.lib) /<WD64>/lib/libwdapi<ver>_32.so on Linux (e.g.,~/WinDriver64/lib/libwdapi1200_32.so) (see details above regarding compilation of 32-bit applications for 64-bitplatforms).

 

  1. Write a 32-bit application that communicates with WinDriver via the DLL/shared object that you created; the application should be implemented to load the relevant version of the DLL/shared object — 32-bit or 64-bit — depending on the platform on which it is run.
    Note: This application should be compiled using an appropriate32-bit compiler, without the KERNEL_64BIT definition.

NOTE

When distributing a driver that was developed using this method, be sure to distribute the relevant files for each target platform:

  • For 32-bit platforms, distribute the application together with the 32-bit version of your WinDriver-wrapper DLL/shared object, and with the standard 32-bit files from the 32-bitWinDriver installation, including the 32-bit WinDriver DLL/shared object (<WD32>\redist\wdapi<ver>.dll on Windows / <WD32>/lib/libwdapi<ver>.so on Linux).
  • For 64-bit platforms, distribute the application together with the 64-bit version of your WinDriver-wrapper DLL/shared object, and with the standard 64-bit files from the 64-bitWinDriver installation, including the 64-bit WinDriver DLL/shared object (<WD64>\redist\wdapi<ver>.dll on Windows / <WD64>/lib/libwdapi<ver>.so on Linux).

For detailed distribution instructions, refer to the WinDriver User’s Manual.