National Instruments 372139B-01 Automobile User Manual


 
Chapter 3 Application Development
© National Instruments Corporation 3-3 Automotive Diagnostic Command Set User Manual
pointers to Automotive Diagnostic Command Set functions in the
application. The following section describes how to use 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 shows how to call Win32
LoadLibrary to load the Automotive Diagnostic Command Set API DLL:
#include <windows.h>
#include "nidiagcs.h"
HINSTANCE NiDiagCSLib = NULL;
NiMcLib = LoadLibrary("nidiagcs.dll");
Next, the application must call the Win32 GetProcAddress function to
obtain a pointer to each Automotive Diagnostic Command Set function the
application uses. For each function, you must declare a pointer variable
using the prototype of the function. For the Automotive Diagnostic
Command Set function prototypes, refer to Chapter 6, Automotive
Diagnostic Command Set API for C. Before exiting the application, you
must unload the Automotive Diagnostic Command Set DLL as follows:
FreeLibrary (NiDiagCSLib);
Debugging an Application
To debug your diagnostic application, use the LabVIEW example
Diagnostic Monitor.vi. This example monitors the CAN traffic the
diagnostic protocols generate on the level of individual CAN messages. It
works with all other Automotive Diagnostic Command Set examples and
diagnostic applications using the Automotive Diagnostic Command Set.
To launch this tool, open the LabVIEW Example Finder and search for
Diagnostic Monitor.vi under Hardware Input and Output/CAN/
Automotive Diagnostic Command Set/Diagnostic Monitor.