Choose the Programming Language
- Updated2025-10-13
- 3 minute(s) read
The programming language you use for application development determines how to access the ECU M&C APIs.
LabVIEW
ECU M&C Toolkit functions and controls are available in the LabVIEW palettes. In LabVIEW, the ECU M&C Toolkit palette is located:
- Within the All Functions palette for LabVIEW 7.1
- Within the Addons palette for LabVIEW 8.0 and 8.1
The reference for each ECU M&C Toolkit API function is in a separate topic identified by the VI name. To access the reference for a function from within LabVIEW, press Ctrl-H to open the Help window, click the appropriate ECU M&C function, and then follow the link. The ECU M&C Toolkit software includes a full set of examples for LabVIEW. These examples teach programming basics as well as advanced topics. The example help describes each example and includes a link you can use to open the VI.
LabWindows/CVI
Within LabWindows/CVI™, the ECU M&C Toolkit function panel is in Libraries»ECU Measurement and Calibration Toolkit. Like other LabWindows/CVI function panels, the ECU M&C Toolkit function panel provides help for each function and the ability to generate code. The reference for each API function is located in a separate topic identified by the function name. You can access the reference for each function directly from within the function panel. The header file for the ECU M&C APIs is niemc.h. The library for the ECU M&C APIs is niemcc.lib. The toolkit software includes a full set of examples for LabWindows/CVI. The examples are installed in the LabWindows/CVI directory under samples\ecumc. Each example provides a complete LabWindows/CVI project (.prj file).
A description of each example is provided in comments at the top of the .c file.
Visual C++ 6
The ECU M&C Toolkit software supports Microsoft Visual C/C++ 6. The header file for Visual C/C++ 6 is in the Program Files\National Instruments\Shared\ExternalCompilerSupport\C\include folder.
To use the ECU M&C API, include the niemc.h header file in the code, then link with the niemcc.lib library file.
The niemcc.lib library file is in the Program Files\National Instruments\Shared\ExternalCompilerSupport\C\lib32\msvc folder.
For C applications (files with a .c extension), include the header file by adding a #include to the beginning of the code, like this:
#include "niemc.h"
For C++ applications (files with a .cpp extension), define __cplusplus before including the header, like this:
#define __cplusplus
#include "niemc.h"
The __cplusplus define enables the transition from C++ to the C language functions.
The reference for each API function is in the C function topic identified by the function name.
On Windows Vista (with Standard User Account), the typical path to the C examples folder is \Users\Public\Documents\National Instruments\ECU Measurement and Calibration Toolkit\Examples\MS Visual C.
On Windows XP/2000, the typical path to the C examples folder is \Documents and Settings\All Users\Documents\National Instruments\ECU Measurement and Calibration Toolkit\Examples\MS Visual C.
Each example is in a separate folder. A description of each example is in comments at the top of the .c file. At the command prompt, after setting MSVC environment variables (such as with MS vcvars32.bat), you can build each example using a command such as:
cl /I<HDir> measure.c <LibDir>\niemcc.lib
<HDir> is the folder where niemc.h can be found.
<LibDir> is the folder where niemcc.lib can be found.
Other Programming Languages
The ECU M&C Toolkit software does not provide formal support for programming languages other than those described in the preceding sections. If the programming language provides a mechanism to call a Dynamic Link Library (DLL), you can create code to call ECU M&C API functions. All functions for the ECU M&C API are located in niemcc.dll. If the programming language supports the Microsoft Win32 APIs, you can load pointers to ECU M&C Toolkit functions in the application. The following text demonstrates use of the Win32 functions for C/C++ environments other than Visual C/C++ 6. For more detailed information, refer to Microsoft documentation.
The following C language code fragment illustrates how to call Win32 LoadLibrary to load the DLL for the ECU M&C API:
#include <windows.h>
#include "niemc.h"
HINSTANCE NiMcLib = NULL;
NiMcLib = LoadLibrary("niemcc.dll");
Next, the application must call the Win32 GetProcAddress function to obtain a pointer to each ECU M&C Toolkit function that the application will use. For each function, you must declare a pointer variable using the prototype of the function. For the prototypes of each ECU M&C Toolkit function, refer to the C function topic identified by the function name.
Before exiting the application, you must unload the ECU M&C Toolkit DLL as follows:
FreeLibrary (NiMcLib);