ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamically changing the name of the .dll file to load in call Library

Our current model is to use dll files as "plug-in" modules for instruments and a top layer test step calls the appropriate driver dll.
 
For instance
 
the TestStep is called with the kenmore.dll passed as a parameter so the kenmore.dll file is loaded, the functions are registered and the functions are called.  Next the TestStep is called with whirlpool.dll as a parameter now the whirlpool.dll is loaded the functions are registered and the functions are called.  This works very well in our current CVI/LabWindows environment.  Now we plan to work with LabView, we wish to retain this model (as DLL files, there are advantages in our model for us).  We have not found a way to load these dll files from LabView without hard coding the path and filenames in.
 
Any suggestions on how to dynamically change the path in the Call Library module, or another suggested method of loading the dll via LabView?
 
Thanks,
0 Kudos
Message 1 of 5
(3,230 Views)

Before we go to far...

Is the calling convention the same for all of the dll's?

If they were you MAY be able to do this with LV scripting but that is not supported even if it was.

The LabVIEW way of doing this is to have a unique "wrapper" VI for each dll and then load the appropriate wrapper VI when it is time to do the dynamic call.

If all of your wrapper VI's have a common icon layout (LV equivelent of a a calling convention) then a "call by reference" node can be used to do the calling as required.

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 2 of 5
(3,225 Views)

Additionally, LabVIEW R&D has received this feature request before (the ability to dynamically assign the DLL called by a Call Library Node), so you may see it in a future LabVIEW version.

-D

0 Kudos
Message 3 of 5
(3,216 Views)


@John Stuart wrote:
Our current model is to use dll files as "plug-in" modules for instruments and a top layer test step calls the appropriate driver dll.
 
For instance
 
the TestStep is called with the kenmore.dll passed as a parameter so the kenmore.dll file is loaded, the functions are registered and the functions are called.  Next the TestStep is called with whirlpool.dll as a parameter now the whirlpool.dll is loaded the functions are registered and the functions are called.  This works very well in our current CVI/LabWindows environment.  Now we plan to work with LabView, we wish to retain this model (as DLL files, there are advantages in our model for us).  We have not found a way to load these dll files from LabView without hard coding the path and filenames in.
 
Any suggestions on how to dynamically change the path in the Call Library module, or another suggested method of loading the dll via LabView?
 
Thanks,


As Ben has pointed out LabVIEW scripting may be a possibility but you are going with that in highly unsupported area. Also I happen to know that changing the library name of a Call Library Node through scripting has produced unsupported feature errors previous to LabVIEW 7.1 eventhough the method was there. And LabVIEW 8 hides the whole scripting business behind the license manager.

Another approach at least if the different DLLs do not change to often thier functions and parameters would be to create a wrapper DLL. Have it a method that loads the desired DLL and links its functions to internal function pointers. Then when calling the actual function entry points just redirect directly to the correct fucntion through that function pointer. Since you are already working in CVI creating such a DLL should be only a matter of taking out a little bit of your already existing code and put it into a DLL project.

Rolf Kalbermatter

Message Edited by rolfk on 04-12-2006 07:40 AM

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
Message 4 of 5
(3,212 Views)
Hi,


See this thread:


http://forums.ni.com/ni/board/message?board.id=170&message.id=39381&requireLogin=False


I'll repost the library to this thread.


Regards,


Wiebe.


"John Stuart" <x@no.email> wrote in message news:1144793408071-350967@exchange.ni.com...
Our current model is to use dll files as "plug-in" modules for instruments and a top layer test step calls the appropriate driver dll.
&nbsp;
For instance
&nbsp;
the TestStep is called with&nbsp;the kenmore.dll passed as a&nbsp;parameter so the kenmore.dll file is loaded, the functions are registered and the functions are called.&nbsp; Next the TestStep is called with whirlpool.dll as a parameter now the whirlpool.dll is loaded the functions are registered and the functions are called.&nbsp; This works very well in our current CVI/LabWindows environment.&nbsp; Now we plan to work with LabView, we wish to retain this model (as DLL files, there are advantages in our model for us).&nbsp; We have not found a way to load these dll files from LabView without hard coding the path and filenames in.
&nbsp;
Any suggestions on how to dynamically change the path in the Call Library module, or another suggested method of loading the dll via LabView?
&nbsp;
Thanks,
Message 5 of 5
(3,206 Views)