When a LabVIEW executable is run for the first time, it creates a
.ini file in the same directory and is named the same as the executable itself. To allow running multiple instances you will need to add a line to the
.ini config file that is created after running a LabVIEW executable. By adding this line to the
.ini file, you can enable the launching of multiple instances of the corresponding executable. The line is:
allowmultipleinstances = TRUE
There are three methods to add this line:
- Call LV Config Write Boolean.vi when the executable is executed
- Manually edit the created INI config file
- Use a custom configuration file when building an executable file
Call LV Config Write Boolean.vi when the executable is executed
If you would like the parameter programmatically added when executing the executable, you can consider this method.
- The LV Config Write Boolean.vi is a hidden API in LabVIEW, to use it, you will need to navigate to C:\<Program Files>\National Instruments\<LabVIEW Version>\resource\dialog\lvconfig.llb and add LV Config Write Boolean.vi from the library to the LabVIEW block diagram.
- Add string constant and boolean constant as input to the API. The boolean constant is set to True and the String constant is set to allowmultipleinstances as shown below:
This code will update the executable INI file with the specified parameter when the executable runs for the very first time. After this, any subsequent launch of the executable will utilize the allowmultipleinstances parameter.
- Build your executable and execute it once. The executable now should be allowed to execute multiple instances.
Back to Index
Manually edit the created INI config file
In this method, you will manually edit the created INI config file to add or change a parameter.
- Build a LabVIEW executable.
- Run the executable one time. Observe that a .ini config file is created in the same directory as the executable.
- Close the execution of the application and open the configuration .ini file.
- Add the following line to the .ini file beneath the [<Application_Title>] line, where <Application_Title> is the name of your executable (i.e. <Application_Title>.exe):
allowmultipleinstances = TRUE
- Save and close the .ini file.
- You can now run multiple instances of this application simultaneously
Back to Index
Use a custom configuration file when building an executable file
You can automate the process of adding tokens to the
.ini file, by selecting a custom configuration file in the Build Specifications Properties box in your project. The option will be in the
Pre/Post Build Action category.
- Select require Post build VI as shown below:
You can generate the template VI and edit it if you do not have any by pressing the
Generate VI button.
- Modify the template VI as shown below to enable the allowmultipleinstances parameter.
- Build the executable. The generated .ini config file for the executable should show the below parameter:
allowmultipleinstances = TRUE
Back to Index
Additional Information
Some functions like Queues or Semaphores are only valid inside the process in which they were created. In the LabVIEW Development Environment, all VIs are running in the same process. When those VIs are built into an executable, each instance of the executable will run in its own process. For more information, read
Will LabVIEW Queues or Semaphores Work Between Executables?