Using NI-SWITCH in Visual C++

NI Switches

Using NI-SWITCH in Visual C++

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

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

  1. Open an existing or new Visual C++ project.
  2. Create source files of type .c (C source code) or .cpp (C++ source code) and add them to the project. Make sure that you include the NI-SWITCH header file, NISWITCH.h, as follows in your source code files: #include "NISWITCH.h"
  3. Specify the directory that contains the NI-SWITCH header file under the Preprocessor»Additional include directories settings in your compiler—for Visual C++ 6.0 these files are under Project»Settings»C/C++. The NI-SWITCH header files are located in the .\Include directory within your NI-SWITCH directory.
  4. Add the NI-SWITCH import library niswitch.lib to the project under Link»General»Object/Library Modules. The NI-SWITCH import library files are located at IVI\Lib\msc.
  5. Add NI-SWITCH function calls to your application.
  6. Build your application.
Tip  You can use the #define topology names in niSwitchTopologies.h to get compile-time checking for topology spellings.

Example Programs

For more information about NI-SWITCH examples, including example locations, refer to Examples.

Special Considerations

String Passing

To pass strings, pass a pointer to the first element of the character array. Be sure that the string is null-terminated.

Parameter Passing

By default, C passes parameters by value. Remember to pass pointers to variables when you need to pass by address.