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:
- Open an existing or new Visual C++ project.
- 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"
- 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.
- 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.
- Add NI-SWITCH function calls to your application.
- 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.