From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

load dll on use

Solved!
Go to solution

Is it possible to make DLL (not/or .net assembly) to be loaded when sub VI with it tries to execute, not when application is loading?

Main application is quiet universal, on some systems it works with specific hardware, on other systems this hardware is not installed and not used (software feature is disabled). But when I load application, it requires this driver dll.

 

One option is to wrap dll call(s) into dynamically loaded VI(s), check it is (they are) alway included into exe build (there is not one calling application), but it is not ideal.

 

I was looking at conditional disable symbols, but could not find way to specify them after exe is built, for example in Appname.exe.config, or AppName.ini file. 

Any other options?

LabVIEW 2011, win 7. But would be glad to know this is implemented in later labview for future upgrade 😃

0 Kudos
Message 1 of 3
(3,099 Views)

@Alexander_Sobolev wrote:

Is it possible to make DLL (not/or .net assembly) to be loaded when sub VI with it tries to execute, not when application is loading?

Main application is quiet universal, on some systems it works with specific hardware, on other systems this hardware is not installed and not used (software feature is disabled). But when I load application, it requires this driver dll.

 

One option is to wrap dll call(s) into dynamically loaded VI(s), check it is (they are) alway included into exe build (there is not one calling application), but it is not ideal.

 

I was looking at conditional disable symbols, but could not find way to specify them after exe is built, for example in Appname.exe.config, or AppName.ini file. 

Any other options?

LabVIEW 2011, win 7. But would be glad to know this is implemented in later labview for future upgrade 😃


The Conditional Disable structure logic gets baked in when you compile based on whatever the symbol states are at compilation so this won't help you. The dynamically loaded VI soltuion is your best bet to my knowledge.

Message 2 of 3
(3,065 Views)
Solution
Accepted by Alexander_Sobolev

Another approach is to enable the option in the Call Library Node configuration dialog to specify the library path on the diagram. This adds an extra terminal to the Call Library Node where you can wire a path to define what shared library to load. This is optimized to not reload the shared library on each execution by comparing the currently lspecified library path with the previously loaded one and only reload the library if they are not the same, the node will first unload the previous library and then load the new library. An empty input path will unload any previously loaded library but not load anything (and might return with an according error that you would need to ignore if you use the error terminal of the Call Library Node).

 

As to conditional compile node they are defined at compile time, not runtime, so they will not work for what you want to do.

 

But .Net nodes don't have that option, so there you will have to resort to dynamically load the according VIs if you want to use that funcitonality.

Rolf Kalbermatter
My Blog
Message 3 of 3
(3,027 Views)