Skip to content

Latest commit

 

History

History
69 lines (55 loc) · 3.82 KB

Create Test Application.md

File metadata and controls

69 lines (55 loc) · 3.82 KB

Create a Simple Test Application

We want to create a simple test application. This application will consist of three main parts:
  • A payload (In this case is an executable)
  • Dependencies, which we will have two types:
    • NI Software (LabVIEW Run-Time Engine)
    • Third-party Software (A custom shared library (dll) that we are going to create a NIPM package to distribute)

Create the Shared Library

For this example, we are going to create a very simple library. Or you can download it from the resources file.
  1. Create a new blank project

  2. Right-click My Computer in the Project Explorer and select New » VI

  3. Create a VI that displays a dialog box containing the contents of a string input and outputs the string afterwards

    Code Snippet

  4. Connect the front panel controls and indicators to the connector pane

  5. Save the VI as displayDialog.vi

  6. Right-click on Build Specifications and select New » Shared Library to generate a dynamic link library (.dll)

  7. Define the Packed Library Properties:

    1. Build Specification name: SimpleDLL
    2. Target filename: SimpleLib.dll
    3. Destination directory: C:\Users\<user>\Documents\NIPM Package Tutorial\builds\SharedLibrary\My DLL

    SimpleDLL Properties

  8. Under Source Files select the displayDialog and press arrow directing towards Exported VIs

  9. A window will pop-up called Define VI Prototype, but if does not, press the Define Prototype button. It should all be the default values below:

    • StringIn

      Define VI Prototype - StringIn

    • StringOut

      Define VI Prototype - StringOut

    • Len

      Define VI Prototype - Len

  10. Select OK

  11. Select Build. You should now be able to find your packed library in the builds folder

  12. In Windows Explorer, create a folder in C:\Program Files(x86) called SimpleLibrary

  13. Move SimpleLib.dll to C:\Program Files(x86)\SimpleLibrary

Create the Payload Executable

This will be the main application we want to distribute. It will depend on LabVIEW Run-Time Engine and our Simple Library.
  1. Create a new blank project and save it as mainApplication.lvproj

  2. For this example we are going to create a UI that takes in a text input, then displays it in a dialog box when we press the okay button. We will also have an exit button that stops the application. Save the vi as main.vi

    main.vi front panel

  3. Add a Call Library Function Node to the VI

  4. Double-click the node and add the Library Path and Function Name

    Call Library Function

  5. Fill in the parameters to match the VI Prototype from the previous section

  6. Create the block diagram as shown below.

    main.vi block diagram OK event case

  7. Here is the Exit event case

    main.vi block diagram EXIT event case

  8. Test the VI and save

  9. Right-Click Build Specifications and select New » Application (EXE)

  10. In the My Application Properties fill out the following information:

    1. Build Specification Name: NIPM test
    2. Target filename: NIPMtest.exe
    3. Destination directory: C:\Users\<user>\Documents\NIPM Package Tutorial\builds\mainApplication\NIPM test
  11. Under Source Files set the main.vi as the Startup VI.

  12. Under Additional Exclusions check Exclude dependent shared libraries. This will prevent the dll from being added to executable.

  13. Select build, then test the output to ensure that it works.

  14. Move the executable to another location on the computer and test that it works again.