LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamically loading a .net assembly

I am trying to interface with a proprietary .net dll. The problem I am having is that this dll can be in multiple places and may not always be in one location. This means that when I open a VI that tries to  link to the dll and it is not in the correct location, the VI throws warnings that I don't want my users to ever see. The NI help that I have seen makes it clear that when the VI is opened any .net assemblies referenced are loaded.

 

I have tried breaking the portion of the VI that interfaces with the dll in to a sub VI and then trying to dynamically load it after checking that the dll is present in the expected location. I have tried "dynamically loading" and and "call by reference", "Call by reference" does not work as it still tries to load the .net assembly no matter what the "call setup" settings are. Dynamically opening the sub VI seems to work in the sense that if the sub vi references a bad dll location, the caller does not fault unless it is run. However, I am also trying to manage some .net references which seem to be dropped in the dynamically called sub vi. I have tried using global variables to hold the references as well as doing a "get value" from the upper level VI.

 

I am not real familiar with the .net world and would appreciate any pointers you can give me.

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

For your application, dynamically calling the vi that uses .NET is the way to go.  I think the problem that you are having is passing values between main vi and dynamically called vi.  If I were use, I will created a queue in the main vi and reference to the same queue by name in the dynamically called vi.  Let me know does that work.

------------------------------------------------------------------

Kudos and Accepted as Solution are welcome!
0 Kudos
Message 2 of 3
(2,979 Views)

It is unfortunately not possible to handle .NET assemblies in the fashion you wish.  One workaround possibility is to put a shortcut to the dll into the VI directory.  This would throw a warning, but allow the dll to change location without breaking the program.  For more information on .NET assemblies and how they are loaded into LabVIEW, see the following links:

 

http://digital.ni.com/public.nsf/allkb/32B0BA28A72AA87D8625782600737DE9

 

http://digital.ni.com/public.nsf/allkb/C4EA5ABBEB67AF7C862573F3004D4421 

 

Patrick W.
Applications Engineer
National Instruments
0 Kudos
Message 3 of 3
(2,948 Views)