LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

dynamically load dll 2012

Hi,

I would like to load DLL dynamically but I do not want to be dependant on the location, name, etc. My idea is that i have an interface main VI where any dll is loaded. Every DLL would have own corresponding interface vi which would be loaded to the subpanel on the main interface VI. I have found that the dynamically dll or VI must be specified before compilation. However, I was able to find only old posts and ideas and I still hope that it has changed in newer LVs versions. Do anyone have any idea or experience with this issue ? is it feasible at all ?

0 Kudos
Message 1 of 10
(3,170 Views)

This is possible with LabVIEW OOP, though I'm not sure how well it builds into a DLL. With LabVIEW OOP, the interface you speak of would be a dynamic dispatch VI. It would take as an input the reference to the sub panel, when called it should insert itself into the subpanel and remove when it closes.

Charles Chickering
Architecture is art with rules.

...and the rules are more like guidelines
0 Kudos
Message 2 of 10
(3,168 Views)

I'm not sure I understand the entire context of what you're going for but in the past I've been able to dynamically load DLLs (that's kind of redudant 🙂 ) by checking "specify path on diagram" from the "Configure..." menu of the Call Library Function Node then providing a path. Now if every DLL you'll be loading has the same input and outputs this should work fine. This is basically how it works in any other programming language.

 

Path to DLL

0 Kudos
Message 3 of 10
(3,151 Views)

The point is, that the function do not have the same inputs... it should be a library of DLLs and the user can call any of the DLL. The main VI would contain the user event mechanism and subpanel to load the DLLs interface. The DLL library should be expandalbe independently on the main VI.

0 Kudos
Message 4 of 10
(3,130 Views)

@charlie87 wrote:

The point is, that the function do not have the same inputs... it should be a library of DLLs and the user can call any of the DLL. The main VI would contain the user event mechanism and subpanel to load the DLLs interface. The DLL library should be expandalbe independently on the main VI.


Why don't you make LabVIEW VI wrappers around different dll and there different exposed functions (methods) and also, may be, combine it all in a polymorphic VI.

So now based on user's selection, call correspoding LabVIEW VI (dynamically or statically)


I am not allergic to Kudos, in fact I love Kudos.

 Make your LabVIEW experience more CONVENIENT.


0 Kudos
Message 5 of 10
(3,120 Views)

Thank you for your answer, it helped me very much. Now I am interested in anohter issue. I would like to merge the e.g. C++ dll and the interface VI (the wrapper created by the import shared lib. wizard) into one dll. Is it possible ?

0 Kudos
Message 6 of 10
(3,104 Views)

It should be if you perform all of this work inside of a LabVIEW Project.

 

After importing code using the shared library wizard you should be able to edit the interface VI wrapper's block diagram to include a call library function node to your C++ DLL file. Next, create a DLL build specification from the project and select the wrapper DLL as the main VI. You should probably include the C++ DLL under the include section as well.

 

 

Craig

0 Kudos
Message 7 of 10
(3,100 Views)

Nice, It works, however there is one problem.

I set the final dll (include original dll + VI GUI) without inputs and outputs. ( void function (void) ). Morever, I added to the VI GUI the Property Node to display the Front Panel when the VI is called. Then I created the Call Library Funciton easily. When the Call Library Function runs (it is called in top level main VI), the VI GUI is displayed as expected... Now I would like to insert input values to the controls, press button RUN (in top level main VI or in the GUI VI) and get the result in the indicators (in the GUI VI). 

 

I tried to add the event structure to the GUI VI with the RUN button, but it makes the LabView crash and shoutdown....

0 Kudos
Message 8 of 10
(3,088 Views)

@craige wrote:

It should be if you perform all of this work inside of a LabVIEW Project.

 

After importing code using the shared library wizard you should be able to edit the interface VI wrapper's block diagram to include a call library function node to your C++ DLL file. Next, create a DLL build specification from the project and select the wrapper DLL as the main VI. You should probably include the C++ DLL under the include section as well.

 

 

Craig



Hi Craig,
I tried your idea and it seemed like good idea. It worked. However I have noticed that the original DLL was not included in the final DLL together with the wrapper VI. Instead of this, the data directory was created and the original DLL was put into in. As a result, I have two DLL. The final DLL calls the original in the data directory. I have tried to set the build specification to include the VI wrapper and original DLL into one DLL but I was not succesfull. Any idea ? 

0 Kudos
Message 9 of 10
(3,077 Views)

Charlie,

 

Your description below is not enough for me to understand the issue. If you are dynamically loading DLLs using the path method as described above then you will need to specify that the desired DLL is set as "Always Include" within the Source Files category within your Build Specification. From there you should be able to specify the path that the DLL is eventually built to using the "Destinations" category. Again, I'm not sure why two DLLs are being included unless they are statically linked within your labVIEW VI (e.g. directly called). Please provide more information

 

Craig

0 Kudos
Message 10 of 10
(3,041 Views)