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

Chapter 3

CINs

Refer to the Microsoft Windows subsection in the Step 4. Compile the CIN Source Code section in this chapter for information about creating a CIN using these compilers.

Solaris, Linux, and HP-UX

LabVIEW for Sun supports external code compiled in a shared library format. To prepare this library for LabVIEW, use LabVIEW utility lvsbutil.

The gcc compiler is tested thoroughly with LabVIEW on Solaris, Linux, and HP-UX platforms. For Solaris, Sun Workshop C Compiler is also tested thoroughly with LabVIEW.

Resolving Multithreading Issues

You must resolve two issues in order to make multithreaded CINs:

Make LabVIEW recognize your CIN as being multithreaded.

Use C code that is completely multithread safe.

Making LabVIEW Recognize a CIN as Thread Safe

The CIN node on the block diagram is orange if you have not set the node to be thread safe. A thread safe node is yellow. Perform the following steps to make LabVIEW recognize a CIN node as thread safe.

Add the CINProperties function to your CIN code, in the prototypes section of your .c source file:

CIN MgErr CINProperties(int32 prop, void *data);

Add the following function statement to the functions section of your .c source file:

CIN MgErr CINProperties(int32 prop, void *data)

{

switch (prop) {

case kCINIsReentrant: *(Bool32 *)data = TRUE; return noErr;

}

return mgNotSupported;

}

Using External Code in LabVIEW

3-2

www.ni.com

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