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

 

Chapter

External Subroutines

4

 

This chapter describes how to create and call shared external subroutines from other external code modules.

Introduction

An external subroutine (or shared external subroutine) is a function that you can call from multiple external code modules. By placing common code in an external subroutine, you can avoid duplicating the code in each external code module. You can also use external subroutines to store information that must be accessible to multiple external code modules.

External subroutines are different from CINs in that LabVIEW diagrams do not call them directly. Instead, an external subroutine is a function that CINs and other external subroutines call. You store external subroutines in separate files, not in VIs.

When you load a VI that contains a CIN, LabVIEW determines whether the CIN references external subroutines. If it does, LabVIEW loads the external subroutines into memory and modifies the calling code so that it can call the subroutine. LabVIEW modifies any additional subroutines that reference the same external subroutine to reference the code already in memory. When you remove the last code that references the external subroutine from memory (when you close the VI containing the CIN), LabVIEW also unloads the external subroutine.

Placing code in external subroutines is helpful for several reasons.

A single subroutine is easier to maintain, because you need update only a single file to affect all calls on the subroutine.

A single subroutine can also reduce memory requirements, because only a single instance of the code is in memory, regardless of the number of calls to the subroutine.

An external subroutine can maintain information used by multiple external code modules. The first time the external subroutine is

© National Instruments Corporation

4-1

LabVIEW Code Interface Reference Manual

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