Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Using External Code in LabVIEW.pdf
Скачиваний:
109
Добавлен:
29.05.2015
Размер:
1.85 Mб
Скачать

Chapter 4 Programming Issues for CINs

Note In LabVIEW 4.x and earlier, Boolean data types were stored as 16-bit integers. If the high bit of the integer was 1, it was TRUE; otherwise, it was FALSE.

Refnums

LabVIEW treats a refnum the same way as a scalar number and passes refnums with the same conventions it uses for numbers.

Clusters of Scalars

For a cluster, LabVIEW passes a pointer to a structure containing the elements of the cluster. LabVIEW stores fixed-size values directly as components inside of the structure. If a component is another cluster, LabVIEW stores this cluster value as a component of the main cluster.

Return Value for CIN Routines

The names of the CIN routines are prefaced in the header file with the words CIN MgErr, as shown in the following example.

CIN MgErr CINRun(...);

The LabVIEW header file extcode.h defines the word CIN to be either Pascal or nothing, depending on the platform. Prefacing a function with the word Pascal causes some C compilers to use Pascal calling conventions instead of C calling conventions to generate the code for the routine.

LabVIEW uses standard C calling conventions, so the header file declares the word CIN to be equivalent to nothing.

The MgErr data type is a LabVIEW data type corresponding to a set of error codes the manager routines return. If you call a manager routine that returns an error, you can either handle the error or return the error so LabVIEW can handle it. If you can handle the errors that occur, return the error code noErr.

After calling a CIN routine, LabVIEW checks the MgErr value to determine whether an error occurred. If an error occurs, LabVIEW aborts the VI containing the CIN. If the VI is a subVI, LabVIEW aborts the VI containing the subVI. This behavior enables LabVIEW to handle conditions when a VI runs out of memory. By aborting the running VI,

LabVIEW can possibly free enough memory to continue running correctly.

© National Instruments Corporation

4-3

Using External Code in LabVIEW

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