Admin Production ni-theme
Current Publication

Side-by-Side Runtime

LabWindows/CVI

Binding Executables and DLLs to Side-by-Side Runtimes

The default, shared LabWindows/CVI Runtime (RTE) is appropriate for most applications built in LabWindows/CVI. However, on occasion you might want to isolate a LabWindows/CVI application from upgrades or downgrades to the LabWindows/CVI RTE.

You can isolate a LabWindows/CVI application from upgrades or downgrades to the LabWindows/CVI RTE by binding an executable or DLL to a specific, side-by-side version of the LabWindows/CVI RTE. Use the Runtime binding option in the Target Settings dialog box to bind an executable or DLL to a side-by-side RTE.

Note Note  The LabWindows/CVI Side-by-Side Runtime is available on Windows only.

The Runtime binding option in the Target Settings dialog box for executables includes the following options:

  • Shared—Binds the executable to the shared LabWindows/CVI RTE. Installing a new version of LabWindows/CVI, a LabWindows/CVI-built distribution, or other National Instruments products can update the shared LabWindows/CVI RTE. Using the LabWindows/CVI Shared RTE for an application ensures that the application has access to the most recent RTE updates and features. This option is appropriate for most applications.
  • <version> side-by-side for entire application—Binds the executable to the version of the LabWindows/CVI Side-by-Side RTE indicated by <version>. Any DLLs in the application bound to the shared RTE use the version of the LabWindows/CVI Side-by-Side RTE to which the executable is bound. Use this option to minimize the possibility of loading multiple versions of the LabWindows/CVI RTE into memory. This option is appropriate for most applications that need to be isolated from upgrades or downgrades to the LabWindows/CVI RTE.
    Note Note  When you use this option and the application calls a DLL bound to the LabWindows/CVI Shared Runtime, ensure that the version of the side-by-side RTE to which you bind the executable is later than or equal to the version of LabWindows/CVI used to build the DLL; otherwise, the LabWindows/CVI RTE will not be able to resolve entry points in the DLL.
  • <version> side-by-side for executable only—Binds only the executable to the version of the LabWindows/CVI Side-by-Side RTE indicated by <version>. Any DLLs in the application bound to the shared RTE use the LabWindows/CVI Shared RTE. Use this option to minimize the likelihood of a DLL not being able to load because the RTE of the executable is older than the Runtime the DLL was built against. Depending on the version of the RTE to which the DLL is bound, the application might load several versions of the RTE into memory, which can impact how your application interacts with data that the RTE owns and manages.
Note Note  The Target Settings dialog box for DLLs includes only the Shared option and a <version> side-by-side option that binds the DLL to the LabWindows/CVI Side-by-Side RTE.

Refer to the Runtime Usage topic for more information about the Runtime binding option and how it affects executables and DLLs.

To distribute an application that contains an executable or DLL bound to the LabWindows/CVI Side-by-Side RTE, you must include the side-by-side RTE in your installer.

Note Note  This feature is compatible with the LabWindows/CVI 2012 Runtime or later. Applications that use DLLs bound to the LabWindows/CVI Side-by-Side Runtime must ensure that the application's shared RTE, if loaded by another module, is version 2012 or later because RTEs prior to 2012 use different shared memory structures than the 2012 shared RTE. If you deploy an application or DLL bound to a side-by-side RTE that is used with older LabWindows/CVI DLLs or applications, consider also deploying the 2012 or later shared RTE to ensure that the older DLLs or applications use the 2012 or later shared RTE.

Runtime Binding Considerations

When you develop an application that you bind to a side-by-side version of the RTE, keep the following considerations in mind:

  • Library and Product Support—LabWindows/CVI libraries and National Instruments products vary in support of side-by-side RTE binding. Refer to the Library and Product Support in the LabWindows/CVI Side-by-Side Runtime topic for more information.
  • Calling LabWindows/CVI-Built DLLs—When you bind a LabWindows/CVI-built executable to a specific version of the LabWindows/CVI RTE, the executable uses that version of the LabWindows/CVI RTE when it executes. However, when a LabWindows/CVI-built executable calls a LabWindows/CVI-built DLL and there are mixed bindings, caveats exist for which RTE loads. Refer to the Runtime Usage topic for more information.
  • Sharing Handles between DLLs—Handles returned by a LabWindows/CVI RTE are specific to that RTE and you must not pass them to another RTE. Because of this, avoid sharing handles between DLLs that you bind to different versions of the LabWindows/CVI RTE. Selecting <version> side-by-side for entire application in the Target Settings dialog box for executables can help you to avoid sharing handles in different RTEs.

    For example, do not reference a user interface panel or a TCP handle in a DLL or executable that is bound to a version of the RTE that is different than the RTE that created the user interface panel or TCP handle.
  • Function Panel Customization DLLs—National Instruments recommends that you do not load more than one version of the LabWindows/CVI RTE into the LabWindows/CVI environment. When bound to a side-by-side RTE, certain DLLs, such as the function panel customization DLLs, cause another instance of the LabWindows/CVI RTE to load in the environment. Avoid binding function customization DLLs to a side-by-side RTE.
  • Standard I/O Window—If your application uses several different side-by-side RTEs and your calls to printf are made within different RTEs, LabWindows/CVI opens a new Standard I/O window for each call. To avoid multiple Standard I/O windows, use the Windows console window instead.
  • Working with Manifest Files—While most users do not need to modify manifest files to utilize side-by-side RTE binding, if you choose to embed a manifest file and also choose to bind an executable or DLL to a side-by-side RTE in the Target Settings dialog box, LabWindows/CVI merges the manifest you want to embed with the side-by-side RTE manifest. LabWindows/CVI then embeds the merged manifest at ID 1 or 2 depending on the side-by-side RTE binding you select. To ensure that User Account Control settings you might have designated work correctly, select the Shared or <version> side-by-side for entire application RTE binding.
    Note Note  Refer to the KnowledgeBase on ni.com for more information about application manifests.
  • ISOLATION_AWARE_ENABLED Macro—Selecting <version> side-by-side for executable only or <version> side-by-side for entire application from the Target Settings dialog box for executables or <version> side-by-side from the Target Settings dialog box for DLLs defines the Windows SDK ISOLATION_AWARE_ENABLED macro as 1 for the project. Calls you make using the Windows SDK LoadLibrary function are redirected to an isolation-aware version of LoadLibrary that uses the calling executable or DLL's manifest to load the called DLL.

    If an object file or static library calls LoadLibrary on a RTE DLL, and is also linked in an executable or DLL that is bound to a side-by-side RTE, LoadLibrary returns the shared RTE instead of the side-by-side RTE if the object file or static library is built without defining the ISOLATION_AWARE_ENABLED macro.
  • Threads that Load cvirte.dll—Any thread that loads the LabWindows/CVI RTE should not exit before the application exits. If a worker thread in your application dynamically loads a DLL bound to a RTE other than the executable's RTE, the system will dynamically load the DLL's RTE in the worker thread before loading the DLL. When this happens, your application must ensure that the worker thread does not exit before the application exits.
  • Converting LabWindows/CVI Projects to Microsoft Visual C++ Projects—When you convert a LabWindows/CVI project to a Visual C++ project, the LabWindows/CVI Conversion Wizard does not persist side-by-side RTE binding. The converted project uses the shared RTE.
  • LabWindows/CVI Upgrade Policy—When you install a new major release or service pack release of LabWindows/CVI, the LabWindows/CVI installer updates the shared RTE and installs a new side-by-side RTE. Applications that are bound to a side-by-side RTE continue to use that RTE, unless you rebuild the application with the newly installed version of LabWindows/CVI.

    In the case when National Instruments must release a patch of the LabWindows/CVI RTE, existing applications bound to the original side-by-side RTE will use the patched side-by-side RTE.
  • Debugging Side-by-Side Issues—When debugging your application, in order to find out which version(s) of the LabWindows/CVI RTE your application is using, you can use the Modules window, Windows Event Viewer, and Windows sxstrace.exe tool.