Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Labview Code Interface Reference Manual.pdf
Скачиваний:
33
Добавлен:
29.05.2015
Размер:
1.13 Mб
Скачать

Chapter 1 CIN Overview

Microsoft Windows 95 and Windows NT

You can use the Microsoft SDK C/C++ or the Visual C++ compiler to build CINs for LabVIEW for Windows 95/NT. With proper preparation, you can also use some CINs created using Watcom C for Windows 3.1.

Microsoft SDK C/C++ Compiler

The method for building CINs under Windows 95 or Windows NT is similar to the method for building CINs under Windows 3.1 using the Watcom C compiler.

1.Add a CINTOOLSDIR definition to your list of user environment variables.

Under Windows NT, you can edit this list with the System control panel accessory. For example, if you installed LabVIEW for Windows 95/NT in c:\lv31nt, the CIN tools directory should be c:\lv31nt\cintools. In this instance, you would add the following line to the user environment variables using the System control panel.

CINTOOLSDIR = c:\lv31nt\cintools

Under Windows 95, you must modify your AUTOEXEC.BAT, to set CINTOOLSDIR to the correct value.

2.Build a .lvm file (LabVIEW Makefile) for your CIN. LabVIEW for Windows 95/NT requires you to define fewer variables than LabVIEW for Windows 3.1. You must specify the items in the following list.

name = name of CIN or external subroutine (mult, for example)

type = CIN or LVSB (depending on whether it is a CIN or an external subroutine)

!include $(CINTOOLSDIR)\ntlvsb.mak

If your CIN uses extra object files or external subroutines, you can specify the objFiles and subrNames options. You do not need to specify the codeDir parameter, because the code for the CIN must be in the same directory as the makefile. You do not need to specify the wcDir parameter, because the CIN tools can determine the compiler’s location.

You can compile the CIN code using the following command, where mult is the makefile name.

nmake /f mult.lvm

LabVIEW Code Interface Reference Manual

1-32

© National Instruments Corporation

Chapter 1 CIN Overview

If you want to use standard C or Windows 95 or Windows NT libraries, define the symbol cinLibraries. For example, to use standard C functions in the preceding example, you could use the following .lvm file.

name = mult

type = CIN

cinLibraries=libc.lib

!include $(CINTOOLSDIR)\ntlvsb.mak

To include multiple libraries, separate the list of library names using spaces.

Visual C++ for Windows 95 or Windows NT

To build CINs under Windows NT or Windows 95 using Visual C++, follow the instructions for the Microsoft SDK C/C++ compiler, listed in the preceding section. The one difference is that you must add an IDE = VC line to the beginning of your .lvm file.

Watcom C Compiler for Windows 3.1 under Windows 95 or Windows NT

CINs you have created using the Watcom C compiler for Windows 3.1 should work under Windows 95 or Windows NT. However, if your CIN makes calls to communicate with hardware drivers, performs register or memory mapped I/O, or calls Windows 3.1 functions, it may not work without modification. Windows 3.1 drivers do not run under Windows 95 or Windows NT, so you will have to port any drivers that you may have written for Windows 3.1 to Windows 95 or Windows NT. Also, CINs cannot manipulate hardware directly. To perform register or memory-mapped I/O, you will have to write a Windows 95 or Windows NT driver. If you call Windows 3.1 functions, you should check to make sure that those functions are still valid under Windows 95 and Windows NT.

To create CINs using Watcom C for Windows 3.1, follow the Watcom C instructions given in the Watcom C Compiler subsection of the Compile the CIN Source Code section of this chapter. You must compile the source code for the CINs under Windows 3.1. Use the LabVIEW for Windows 3.1 CIN libraries to compile the CINs.

© National Instruments Corporation

1-33

LabVIEW Code Interface Reference Manual

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]