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

Chapter 3 CIN Advanced Topics

Multiple References to the Same CIN

If you have loaded the same code resource into multiple CINs, or you have duplicated a given code interface node, LabVIEW gives each reference to the code resource a chance to perform initialization or deallocation. No matter how many references you have in memory to a given code resource, the LabVIEW calls the CINLoad routine only once when the resource is first loaded into memory (though it is also called if you load a new version of the resource, as described in the previous section). When you unload the VI, LabVIEW calls

CINUnload once.

After LabVIEW calls CINLoad, it calls CINInit once for each reference to the CIN, because its CIN data space may need initialization. Thus, if you have two nodes in the same VI, where both reference the same code, the LabVIEW calls the CINLoad routine once, and the CINInit twice. If you later load another VI that references the same code resource, then LabVIEW calls CINInit again for the new version. LabVIEW has already called CINLoad once, and does not call it again for this new reference.

LabVIEW Code Interface Reference Manual

3-6

© National Instruments Corporation

Chapter 3 CIN Advanced Topics

VI

global storage

 

(code globals)

VI data space

code resource

 

 

4-byte CIN

Data Space

4-byte CIN

Data Space

4-byte CIN

Data Space

(data space globals)

Figure 3-2. Three CINs Referencing the Same Code Resource

LabVIEW calls CINDispose and CINAbort for each individual CIN data space. LabVIEW calls CINSave only once, regardless of the number of references to a given code resource within the VI you are saving.

Reentrancy

When you make a VI reentrant, LabVIEW creates a separate data space for each usage of that VI. If you have a CIN data space in a reentrant VI and you call that VI in seven places, LabVIEW allocates memory to store seven CIN data spaces for that VI, each of which contains a unique storage location for the CIN data space for that calling instance.

© National Instruments Corporation

3-7

LabVIEW Code Interface Reference Manual

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