2 program - mx100/visual c, Program - mx100/visual c -6, Adding the path to the include file – Yokogawa PC-Based MX100 User Manual

Page 241: Declaration in the source file, Load library statement

Advertising
background image

3-6

IM MX190-01E

3.2

Program - MX100/Visual C -

Adding the Path to the Include File

Add the path of the include file (DAQMX.h) to the project. The method of adding the

include file varies depending on the environment used.

Declaration in the Source File

Write the declaration in the source file.

#include "DAQMX.h"

Note

The include file of the common section (DAQHandler.h) is referenced from the include
file described above. Thus, declaration for it is not necessary.

Load Library Statement

The statement below is added so that the executable module (.dll) of the API can
link to the process.

The executable module (.dll) of the API is mapped within the address space
(LoadLibrary). Next, the address of the export function in the executable module is

retrieved (GetProcAddress).

The callback type of the function pointer is the function name with a prefix “DLL”
added and converted to uppercase. It is defined in the include file of the API.

HMODULE pDll = LoadLibrary("DAQMX");
DLLOPENMX openMX = (DLLOPENMX)GetProcAddress(pDll, "openMX");

Advertising