This topic assumes that you are using the Microsoft Visual C or C++ ADE to manage your code development and that you are familiar with the following ADEs:

  • Microsoft Visual C++ 6.0
  • Microsoft Visual Studio 2010

Using NI-SWITCH in Microsoft Visual C++ 6.0

To develop an NI-SWITCH application with Microsoft Visual C++ 6.0, follow these general steps:

  1. Open an existing or new Visual C/C++ project to manage your application code.
  2. Create source code files of type .c (C) or .cpp (C++).
  3. Add the source code files to the project.
  4. Add the following code in the source code files:

    #include "niswitch.h"

  5. Add the NI-SWITCH include and library files to the project. <IVIROOTDIR32> is an alias to a specific National Instruments file folder location. Refer to the NI-SWITCH Readme File for more information about installed file locations.
    1. Select Project»Settings»C/C++»Preprocessor»Additional include directories, and add the paths, separated by a semicolon, to the niswitch.h and visa.h files. The niswitch.h and visa.h files are located in the <IVIROOTDIR32>\Include and <VXIPNPPATH>\WinNT\include directories, respectively.
    2. Select Project»Settings»Link»General»Object/Library Modules, and add niswitch.lib.
    3. Select Project»Settings»Link»Input»Additional library path, and add the path to the niswitch.lib file. The niswitch.lib file is located in the <IVIROOTDIR32>\Lib\msc or the <IVIROOTDIR32>\Lib x64\msc directory.
  6. Build your application using the appropriate programming flow steps.

Using NI-SWITCH in Microsoft Visual Studio 2010

To develop an NI-SWITCH application with Microsoft Visual Studio 2010, follow these general steps:

  1. Open an existing or new Visual C/C++ project to manage your application code.
  2. Create source code files of type .c (C) or .cpp (C++).
  3. Add the source code files to the project.
  4. Add the following code in the source code files:

    #include "niswitch.h"

  5. Add the NI-SWITCH include and library files to the project. <IVIROOTDIR32> is an alias to a specific National Instruments file folder location. Refer to the NI-SWITCH Readme File for more information about installed file locations.
    1. Select Project»Properties»Configuration Properties»C/C++»General»Additional Include Directories, add the paths, separated by a semicolon, to the niswitch.h and visa.h files. The niswitch.h and visa.h files are located in the <IVIROOTDIR32>\Include and <VXIPNPPATH>\WinNT\Visa\include directories, respectively.
    2. Select Project»Properties»Configuration Properties»Linker»Input»Additional Dependencies, and add niswitch.lib.
    3. Select Project»Properties»Configuration Properties»Linker»General»Additional Library Directories, and add the path to the niswitch.lib file. The niswitch.lib file is located in the <IVIROOTDIR32>\Lib\msc or the <IVIROOTDIR32>\Lib x64\msc directory.
  6. Build your application using the appropriate programming flow steps.

Microsoft Visual C Examples

Installed examples for Visual C/C++ are in the NI-SWITCH Readme File.

The C examples were built and tested using Microsoft Visual C++ 6.0 with Service Pack 5.0. These examples are console-based with no graphical interface.

To build the examples in Microsoft Visual C++ 6.0 using the Microsoft NMAKE utility, complete the following steps:

  1. Go to the directory for the particular example you want to use.
  2. Run the VCVARS32.BAT batch file (located in the \bin directory of the MSVC compiler) to set up the environment variables for command line usage if they are not already set. You might need to increase the initial environment size of the DOS box to accommodate the added environment variables.
  3. To build an example run nmake CFG="Win32 Debug" . The executable is built to the debug subdirectory by default.