NI-FGEN Creating an Application with Visual C/C++

NI Signal Generator

NI-FGEN
Creating an Application with Visual C/C++


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

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

  1. Open an existing or new Visual C/C++ project.
  2. Create source files–.c (C source code) or .cpp (C++ source code)–and add them to the project. Make sure that you include the NI-FGEN header file (niFGEN.h) in your source code files as follows:

    #include "niFGEN.h"

  3. Specify the directory that contains the NI-FGEN 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++. For the location of the NI-FGEN header files, refer to the NI-FGEN Instrument Driver Readme.
  4. Add the NI-FGEN import library (niFGEN.lib) to the project under Link»General»Object/Library Modules. For the location of the NI-FGEN import library files, refer to the NI-FGEN Instrument Driver Readme.
  5. Add NI-FGEN function calls to your application.
  6. Build your application.

NI-FGEN Example Programs for Visual C/C++

To locate the example programs installed with NI-FGEN, refer to the NI-FGEN Instrument Driver Readme.

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, Visual C passes parameters by value. Remember to pass pointers to variables when you need to pass by address.