Creating an executable with LabVIEW

Creating an executable with LabVIEW

Several of our customers have had trouble creating an executable file from a LabVIEW project using the Yoctopuce library. An issue with a "library not found". Therefore this week we are going to provide you with a small tutorial on this topic.





Before anything else, let's remember that to create an executable with LabVIEW you need the professional version of LabVIEW or the "LabVIEW Application builder" option. Moreover, the LabVIEW runtime environment must be installed on the computer on which you intend to run your executable file.

Theory

The LabVIEW Yoctopuce library is based on the DotNetProxyLibrary.dll DLL which requires the yapi.dll DLL. The latter exists in two versions:

  • The 32 bit version which must be located in the same directory as DotNetProxyLibrary.dll.
  • The 64 bit version which must be located in the amd64 subdirectory.

You must imperatively respect this structure, the whole difficulty is to make LabVIEW understand it.

Practice

So here is, step by step, how to proceed so that LabVIEW is able to compile a project while copying all the Yoctopuce DLLs into the correct location. This small tutorial is based on the English versions of Windows and LabVIEW, we let you take care of making the parallel with your own language versions.

Let's assume that we have a very simple project which contains a VI named "TempSensor" which reads and displays the temperature of a Yoctopuce sensor.

A VI to read and display the temperature of a Yoctopuce sensor
A VI to read and display the temperature of a Yoctopuce sensor


Let's call this project Exe-demo. By default, its structure is going to look like the image below:

Basic structure of a LabVIEW project
Basic structure of a LabVIEW project


Step 1

Let's start by telling LabVIEW that the project needs DLLs. A right-click on the my computer node enables us to add the yapi.dll and DotNetProxyLibrary.dll files located in the C:\Program Files\National Instruments\LabVIEW XXXX\vi.lib\Yoctopuce\VIs directory, if the Yoctopuce library was installed with the provided installer.

Adding files to the project
Adding files to the project


Step 2

A new right-click on the my computer node enables us to add a virtual directory that we must imperatively rename amd64.

Adding a virtual directory to the project
Adding a virtual directory to the project


Step 3

Let's add the 64 bit version of yapi.dll in the directory that we just created. This DLL is located in the C:\Program Files\National Instruments\LabVIEW XXXX\vi.lib\Yoctopuce\VIs\amd64 directory. The structure of the project should now look like the image below:

Structure of the project with the DLLs
Structure of the project with the DLLs


Step 4

We now need to tell LabVIEW how it must copy the DLLs. Let's start by creating an "Application (EXE)" node under the "Build Specifications" node.

Adding the EXE node
Adding the EXE node


Right-click on the node to configure its properties. Let's start by naming our executable, in this instance: MyTestExe.exe.

Configuring the executable name
Configuring the executable name


Step 5

Let's now inform LabVIEW in the "Source files" section that it must copy the DotNetProxyLibrary.dll and yapi.dll DLLs and the amd64 directory.

List of files to be copied
List of files to be copied


Step 6

We now need to tell LabVIEW how it must copy the DLLs. To do so, we create in the Destinations section a new destination that we call "YoctopuceDLL" and which has the same destination path as the "Support Directory" entry, but with the "Preserve disk hierarchy" box ticked.

A new destination
A new destination


Step 7

Almost there: in the "Source File Settings" section, we tell for the three entries amd64, DotNetProxyLibrary.dll, and yapi.dll that we want to use the "YoctopuceDLL" destination.

We use the new destination for the DLLs
We use the new destination for the DLLs


It's done

Here you are, it's done. You can now check that the compilation of your project produces the expected file structure in the "Preview" section. The DotNetProxyLibrary.dll, yapi.dll, and amd64/yapi.dll files are supposed to be located in the data subdirectory.

Preview of the project structure
Preview of the project structure


On the down side, we didn't find how to tell LabVIEW that it didn't need to copy the HTML help file of the Yoctopuce library.

After compiling, you find in the builds directory a MyTestExe.exe executable file, a few additional files, and a data directory that you can copy and run on any machine as long as the LabVIEW runtime environment is installed on it.

Tadaa! It's working!
Tadaa! It's working!

Add a comment No comment yet Back to blog












Yoctopuce, get your stuff connected.