Dieser Inhalt liegt nicht in Ihrer bevorzugten Sprache vor.

Der Inhalt wird Ihnen in einer anderen verfügbaren Sprache angezeigt. Ihr Browser bietet ggf. Funktionen, die Sie bei der Übersetzung des Textes unterstützen.

Using External Code on My Real-Time System

Updated Aug 31, 2023

Reported In

Hardware

  • CompactRIO Controller
  • PXI Controller
  • Industrial Controller

Software

  • LabVIEW Real-Time Module

Operating System

  • VxWorks
  • PharLap
  • NI Linux Real-Time

Programming Language

  • C

Issue Details

  • I am using LabVIEW Real-Time (RT) on my RT controller and I would like to write a VI that calls code written in other languages. What languages can I call and how do I call them from within LabVIEW?
  • Is it possible to call a third-party .dll on a cRIO real-time target?
  • I am trying to call a .dll on my RT target but I run into error "Failed to load shared library XXXX.dll". Am I able to call .dll files on my RT target? 

Solution

You can call external code from LabVIEW on a RT target by compiling the code into the Shared Library format of your RT operating system. 
Note: If you try to call shared library files on an unsupported operating system, you will run into errors when your code is deployed. 

To use shared libraries in your LabVIEW Real-Time code:
  1. First, check to see what real-time operating system is running on your device.
  2. Examine the following chart to find which shared library file type you need to compile to:
Real Time Operating SystemVxWorksPharLapLinux-RT
File Type Extension.out.dll.so
 
  1. Call the compiled code with a Call Library Function Node. Only code adherent to the C or stdcall conventions can be integrated in LabVIEW Real-Time.

If you acquired a library from a third-party, you can call this library when working with the supported real-time OS. For example, in order you use a third-party .dll, you would need to be on a PharLap RT target and would not be able to use a Linux RT target.

Additional Information

It is important to note that even though Windows and PharLap both recognize the .dll file extension, DLLs that run on Windows may not run properly on PharLap targets .

NI recommends programming as much of your real-time application as possible using the LabVIEW Real-Time Module.