Chapter 2
Developing Your Application
2-2
ni.com
application. You can then call the NI-CAN functions without any extra
effort.
For C applications (files with
.c
extension), include
nican.h
by adding
the following line to the beginning of your code:
#include "nican.h"
For C++ applications (files with
.cpp
extension), include
nican.h
by
adding the following lines to the beginning of your code:
#define _cplusplus
#include "nican.h"
The
_cplusplus
define allows
nican.h
to properly handle the transition
from C++ to the C language NI-CAN functions.
For Microsoft Visual C++, link your application with the NI-CAN
language interface for Microsoft C/C++,
nicanmsc.lib
.
For Borland C/C++ (5.0 or later), link your application with the NI-CAN
language interface for Borland C/C++,
nicanbor.lib
. For Borland
C/C++ 4.5, you must use direct entry access for NI-CAN.
For LabWindows/CVI, your application is linked with the NI-CAN
language interface for LabWindows/CVI,
nican.lib
. This library is
installed automatically based on the installed compatible compiler.
For detailed information on how to compile and link your NI-CAN
application, refer to the
readme.txt
file in the NI-CAN
examples
directory.
Direct Entry Access
You can directly access
nican.dll
from any programming environment
that allows you to request addresses of functions that a DLL exports.
To use direct entry access, you must first load
nican.dll
. The following
C language code fragment illustrates how to call the Win32
LoadLibrary
function and check for an error:
#include <windows.h>
#include "nican.h"
HINSTANCE NicanLib = NULL;
NicanLib=LoadLibrary("nican.dll");
if (NicanLib == NULL) {