Company Events Academic Community Support Solutions Products & Services Contact NI MyNI

Example: Importing Functions from a Shared Library File (Windows)

LabVIEW 2013 Help

Edition Date: June 2013

Part Number: 371361K-01

»View Product Info

Complete the following steps to create and update a library of VIs based on the functions in a regular expression DLL using the Import Shared Library wizard. Refer to Importing Functions from a Shared Library File to create or update wrapper VIs for functions in any shared library file.

  1. Select Tools»Import»Shared Library to launch the Import Shared Library wizard. The Specify Create or Update Mode page appears.
  2. Select Create VIs for a shared library, and click the Next button to display the Select Shared Library and Header File page of the wizard.
  3. Click the Browse button next to the Shared Library File text box to navigate to and select labview\examples\dll\ImportSharedLibraryExample\ImportSharedLibraryExample.dll. After you select this file, LabVIEW designates labview\examples\dll\ImportSharedLibraryExample\ImportSharedLibraryExample.h as the default header file.
  4. If a checkmark appears in the Shared library file is not on the local machine checkbox, remove it.
  5. Click the Next button to display the Configure Include Paths and Preprocessor Definitions page. You do not need to add any additional include paths or preprocessor definitions for this DLL.
  6. Click the Next button to display the Select Functions to Convert page. A dialog box appears to notify you that LabVIEW is parsing the specified header file.
  7. Select the functions for which you want to create wrapper VIs by placing a checkmark in the checkbox next to each function. The two functions that appear contain checkmarks by default. LabVIEW creates VIs for each of the functions you select.
  8. Click the Next button to display the Configure Project Library Settings page.
  9. By default, ImportSharedLibraryExample appears in the Project Library Name (.lvlib) field. LabVIEW automatically includes all generated VIs within this project library file and gives it a .lvlib file extension. Also by default, labview\user.lib\ImportSharedLibraryExample appears in the Project Library Path field, and the Copy the shared library file to the destination directory checkbox contains a checkmark.
  10. Click the Next button to display the Select Error Handling Mode page.
  11. Select Function Returns Error Code/Status from the Error Handling Mode pull-down menu. If an error occurs, use the error status description to form the error cluster information in LabVIEW.
  12. Click the Next button to display the Configure VIs and Controls page.
  13. Review the configuration for the VIs and controls you want to create. Select a VI or a control on the left and then use the fields on the Settings and Name and Description tabs to review and edit specific information. Make the following changes to the default configuration settings:
    • DWTest_Change_Info()
      1. Change the Default string to initialize the pointer text box for name to Old.
    • DWTest_Copy()
      1. Change Input/Output for outputEnum1 to Output.
      2. Change Input/Output for outputEnum2 to Output.
      3. Change Input/Output for outputRunTimeSizeArray to Output.
      4. Change Input/Output for outputBool to Output.
      5. Change Input/Output for outputString to Output.
    Tip  You can change VI and control names to be more descriptive or to improve readability. Similarly, control names in LabVIEW can include spaces to improve readability.
  14. Click the Next button to display the Generation Summary page, and review the Generation Summary to determine if you are ready to generate VIs. If you want to make any changes, click the Back button.
  15. Click the Next button to create wrapper VIs for the functions you selected in the specified shared library. The Generation Progress page shows the progress of the wizard as it generates the wrapper VIs. When the generation completes, the Finish page appears.
  16. Place checkmarks in the Open the generated library and View the report checkboxes, and click the Finish button to close the wizard, open the project library file, and view the report in the default browser.
  17. Review the report. The report indicates that no errors or warnings occurred.
  18. Review the project library file and the generated VIs within it. After you initially generate the VIs, you can make changes to the VIs individually within the block diagram or front panel of each VI. Then you can re-run the wizard to update the VIs within the library.
  19. Close the ImportSharedLibraryExample.lvlib project library file.

Update the Generated Project Library VIs with Custom Controls

The generated library is complete and usable as is. However, you might want to make changes to several VIs within the library. To do this, you can re-launch the wizard and select the Update VIs for a shared library option on the Specify Create or Update Mode page. With this option, you can update and overwrite specific VIs that you generated previously. Complete the following steps to update a subset of the VIs within ImportSharedLibraryExample.lvlib with custom controls:

  1. Select Tools»Import»Shared Library to launch the Import Shared Library wizard. The Specify Create or Update Mode page appears.
  2. Select Update VIs for a shared library and select ImportSharedLibraryExample.lvlib from the list of projects.
  3. Click the Next button to display the Select Shared Library and Header File page of the wizard. The Shared Library File text box contains the path labview\examples\dll\ImportSharedLibraryExample\ImportSharedLibraryExample.dll, and the Header (.h) File text box contains labview\examples\dll\ImportSharedLibraryExample\ImportSharedLibraryExample.h as the default header file.
  4. Click the Next button to display the Configure Include Paths and Preprocessor Definitions page. You do not need to add any additional include paths or preprocessor definitions for this DLL.
  5. Click the Next button to display the Select Functions to Convert page. A dialog box appears to notify you that LabVIEW is parsing the specified header file.
  6. Select the functions you want to convert by placing a checkmark in the checkbox next to each function. The two functions that appear contain checkmarks by default. Click the Uncheck All button to remove the checkmarks.
  7. Place a checkmark in the checkbox next to DWTest_Copy() to select it as the function to update.
  8. Click the Next button to display the Configure Project Library Settings page. You do not need to change any of the settings on this page.
  9. Click the Next button to display the Select Error Handling Mode page. LabVIEW prompts you to confirm whether you want to overwrite the specified files. Click the OK button.
  10. On the Select Error Handling Mode page, select Function Returns Error Code/Status from the Error Handling Mode pull-down menu.
  11. Click the Next button to display the Configure VIs and Controls page.
  12. Make the following changes to the default configuration settings:
    • DWTest_Copy()
      1. Change the Control Type of outputStruct to Custom Control.
      2. Click the Browse button next to the Path to Custom Control field to navigate to labview\examples\dll\ImportSharedLibraryExample\CustomDefinedControl.ctl as the custom control.
  13. Click the Next button to display the Generation Summary page.
  14. Click the Next button to update the VIs.
  15. On the Finish page, select the Open the generated library option and click the Finish button to close the wizard and open the project library file.
  16. Close the ImportSharedLibraryExample.lvlib project library file.

 

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
Add Comments 1 2 3 4 5 submit