LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can i set the path of the constructor of a DotNet-DLL

Hello,

when insert a -NET Constructor and click on it then i can select a file in the object list or use the Browse button to locate it.

Is there a way to pass the path of the dll intro constructor?

Something like an input parameter of the constructor where i can pass a string constant conaining the path.

 

Thanks

0 Kudos
Message 1 of 6
(1,359 Views)

Unlike the Call Library Function Node with C/C++ dlls, the .NET interface in LabVIEW does not support dynamic assembly loading, so you must manually browse the assembly path and the class to instantiate so that all classes, methods and properties that you access are statically known at edit time.

Message 2 of 6
(1,322 Views)

Raphschru is correct that you can't do this.  I believe that it's because .NET has much stricter typing than traditional DLLs (usually a good thing...).

 

Maybe if you tell us why you feel you need to do this there will be an alternate solution.

Message 3 of 6
(1,317 Views)

As the others said, you cannot specify the path, but you could try the following below and keep all your .NET dlls in a specific folder. It works for the .NET libraries that Thorlabs ships.

 

snip.png

Message 4 of 6
(1,308 Views)

.Net assemblies are never supposed to be loaded from the current directory. That would be a major security concern for .Net. So your Thorlabs DLLs are likely normal binary DLLs that the Thorlabs .Net interface calls through .Net Interop or Platform Invoke.

For binary DLLs the current directory is one of the directories that is searched unless security options for the current user prevent that. But use of the current directory is a brittle solution. A number of things can affect it, including the Windows file selection dialog which will change it to the directory that it was in when you close it affirmative for a file or directory selection!

Rolf Kalbermatter
My Blog
Message 5 of 6
(1,288 Views)

Hello,

 

the reason why i want to do this is because of a problem in TestStand when running a teststep that contains a DotNet constructor. The error code is the same as if the DLL is totaly not available.

The DLL works fine in Labview

The teststep calling the DLL works fine in Teststand with Development-adapter

The teststep calling the DLL works fine in Teststand with Runtime-adapter

A custom GUI calling Teststand-API and executing the above works fine with LV-development-adapter configured in TS

==> BUT NOT WORKING any more with custom GUI when changing in Teststand to LV-runtime adapter (error -17600)

 

So my idea was to give a hardcoded fix path to the constructor if the problem is that the runtime cannot find the DLL.

 

What else can i try to find the reason of this problem?

 

Thanks for all help

 

This is the thread to the problem in the teststand-forum (no answers yet) also with some screenshots.

https://forums.ni.com/t5/LabVIEW/VI-error-when-executing-VI-with-adapter-runtime-in-Teststand/td-p/4...

 

0 Kudos
Message 6 of 6
(1,272 Views)