A shared library is a file containing executable program modules that any number of different programs can use to perform some function. You can call these program modules, or shared library functions, from LabVIEW by using the Call Library Function Node. Call a shared library function when you want to accomplish any of the following tasks:

  • Using functions written in another programming language within LabVIEW
  • Performing tasks that LabVIEW cannot perform with its own functions and VIs, such as calling system routines
  • Completing tasks that are better suited for text-based languages

Shared Libraries on Different Platforms

(Windows) A shared library is called a DLL.

(OS X) A shared library is called a Framework.

(Linux) A shared library is called a Shared Library function.

General Approach to Calling Shared Libraries

Calling a shared library function in LabVIEW includes the following actions:

  1. You obtain or create a shared library.
  2. You configure a Call Library Function Node to call a function within the shared library.
  3. LabVIEW calls the function when the Call Library Function Node executes.
  4. LabVIEW passes input data from the block diagram to the executable code.
  5. LabVIEW returns data from the executable code to the block diagram.

Limitations on Calling Shared Libraries in LabVIEW

  • Shared libraries must use either the stdcall or C calling convention. You can use any language to write shared libraries as long as the shared libraries can be called using one of these two calling conventions.
  • Shared libraries execute synchronously. You cannot reset a VI that is running a shared library until execution completes. If you want to write a shared library that performs a long task, be aware that LabVIEW cannot perform other tasks in the same thread while the shared library executes.
  • VIs that call shared libraries are platform specific. VIs that call functions within shared libraries execute on different platforms only if you have a corresponding library for each platform. If you move a VI that call a shared library with a Call Library Function Node to another platform, you must update the node to specify the version of the shared library that is compiled for the new platform.

Examples and troubleshooting information help you build and use shared libraries and successfully configure the Call Library Function Node in LabVIEW. The general methods described here for DLLs also apply to other types of shared libraries. Refer to the labview\examples\dll directory for examples of using shared libraries.