National Instruments NI-DNET User Manual page 24

National instruments devicenet ni-dnet user manual
Table of Contents

Advertisement

© National Instruments Corporation
2.
Get the addresses for the NI-DNET DLL functions you will use.
Your application must use the Win32
get the addresses of the NI-DNET functions your application needs.
For each NI-DNET function used by your application, you must define
a direct entry prototype. For the prototypes for each function exported
by
, refer to the NI-DNET Programmer Reference Manual.
nican.dll
The following code fragment illustrates how to get the addresses of the
,
ncOpenDnetIO
static NCTYPE_STATUS (_NCFUNC_ *PncOpenDnetIO)
(NCTYPE_STRING ObjName,
NCTYPE_OBJH_P ObjHandlePtr);
static NCTYPE_STATUS (_NCFUNC_ *PncCloseObject)
(NCTYPE_OBJH ObjHandle);
static NCTYPE_STATUS (_NCFUNC_ *PncReadDnetIO)
(NCTYPE_OBJH ObjHandle, NCTYPE_UINT32 SizeofData,
NCTYPE_ANY_P Data);
PncOpenDnetIO = (NCTYPE_STATUS (_NCFUNC_ *)
(NCTYPE_STRING, NCTYPE_OBJH_P))
GetProcAddress(NidnetLib,
(LPCSTR)"ncOpenDnetIO");
PncCloseObject = (NCTYPE_STATUS (_NCFUNC_ *)
(NCTYPE_OBJH))
GetProcAddress(NidnetLib,
(LPCSTR)"ncCloseObject");
PncRead = (NCTYPE_STATUS (_NCFUNC_ *)
(NCTYPE_OBJH, NCTYPE_UINT32, NCTYPE_ANY_P))
GetProcAddress(NidnetLib,
(LPCSTR)"ncReadDnetIO");
If
GetProcAddress
code fragment illustrates how to verify that none of the calls to
GetProcAddress
if ((PncOpenDnetIO == NULL) ||
(PncCloseObject
(PncReadDnetIO == NULL)) {
FreeLibrary(NidnetLib);
printf("GetProcAddress failed");
}
Chapter 3
GetProcAddress
, and
ncCloseObject
fails, it returns a NULL pointer. The following
failed.
== NULL) ||
3-5
Developing Your Application
function to
functions.
ncReadDnetIO
NI-DNET User Manual

Advertisement

Table of Contents
loading

This manual is also suitable for:

Devicenet ni-dnet

Table of Contents