Table Of Contents

Shared Library Interface Best Practices

Last Modified: November 20, 2020

Prepare your Shared Library Interface (SLI) to minimize errors when calling external code.

When implementing an SLI, ensure the following:
  • The SLI has the correct name or path for the shared library.
  • If you specify a shared library using a path, the path is absolute.
  • If you specify a shared library using a name, the library is located in the system search path.
  • All parameters are defined to be passed by the correct method, such as value or pointer.
  • The SLI passes arguments to the function in the correct order.
  • If you are moving a VI that uses an SLI to another platform, you have updated the SLI to specify the version of the shared library that is compiled for the new platform.

If your SLI handles arrays or strings of data, ensure the following:

  • You pass a buffer or array that is large enough to hold any results that the function places in the buffer.
  • If you are passing arrays or strings as LabVIEW NXG handles, you use Manager functions to resize them under Visual C++ or Xcode compilers.
  • Pascal strings do not exceed 255 characters in length.

You cannot reset a VI that is running a shared library until execution of the shared library completes. If you want to write a shared library that performs a long task, your application cannot perform other tasks in the same thread while the shared library executes.

Recently Viewed Topics