LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Multiple Call Library Functions

Hello,

 

I need an effective methode to call external DLL code. There are a lot of functions to call with many arguments. I want to avoid to create one VI for each function. My idea is to use one VI with a case selctor for all functions. The problem is how to handle the arguments? So many input connector at the VI is not efficient.

 

Does anybody has an idea?

 

 

0 Kudos
Message 1 of 6
(3,377 Views)

Why do you want to avoid a separate VI for each DLL call?

 

You could merge the two approaches and create a polymorphic VI (you'll need to read the help on this, and it may not be available in all LabVIEW editions).  This would mean creating one VI for each DLL call, but you could drop a single VI on your block diagram and then select which instance to use from a drop-down menu.

 

The best arrangement for terminals is going to depend on how many possible parameters you need, and how they relate to each other.  Perhaps you can group related parameters into clusters.  If there's some data that's reused from one call to the next, and not needed outside the DLL calls, you could store it in shift registers within the VI that handles the DLL calls.  You might also be able to reuse some terminals (you might have three generic numeric inputs, and the case structure determines which input corresponds to which parameter) but that will quickly become confusing.

0 Kudos
Message 2 of 6
(3,368 Views)

maximint wrote:

Hello,

 

I need an effective methode to call external DLL code. There are a lot of functions to call with many arguments. I want to avoid to create one VI for each function. My idea is to use one VI with a case selctor for all functions. The problem is how to handle the arguments? So many input connector at the VI is not efficient.

 

Does anybody has an idea?

 

 


While it "could"make sense to combine similar APIs (with same number of arguments and most of them being the same type) it is really a bad idea to combine wildly different APIs into one VI, because of the issue you actually mention yourself.

 

If  you use LabVIEW 8.2 or better you can actually use the header file, or if it is to complicated for that parser edit a version that dclares only the strictly necessary types and functions and use the Shared Library Import Wizard to let it create a VI for every exported function call it can handle. The resulting VIs are still not what I would consider a polished VI API Library but a good starting point to go from.

 

Rolf Kalbermatter

 

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
Message 3 of 6
(3,341 Views)

Hi maximint,

 

If I understand correctly, you are trying to use your DLL functions as subVIs to interface with other code in your application, but do not want to create multiple VIs for each function instance. I suggest either building a polymorphic VI or simply putting down a call library function node and choosing which function you'd like to call by double-cliking the node and selecting the DLL.

 

 

 

Misha
0 Kudos
Message 4 of 6
(3,312 Views)

Hi mishkin

 

yes that' s true. There are a lot of "foreign" C-DLL  s  which habe to be implemented in my LV 7.1 application.

I don't want to create a VI for each single DLL function.

I try to use this selector which depending in the selected ring text the specific DLL is called.

May be, I've to learn a lot about polymorphi VIs to implement this without used a lot of different inputs.

Could someone tip me one a simple starting example on how to create polymorphic VIs ?

 

Thank's a lot for your suggestions.

By the way, the link  "polymorphic VI" in your threat doesn't work.

 

Message Edited by maximint on 01-21-2009 04:11 PM
Message Edited by maximint on 01-21-2009 04:13 PM
0 Kudos
Message 5 of 6
(3,299 Views)

Sorry about that, maximint, here's the correct link:

http://zone.ni.com/reference/en-XX/help/lv/71/lvhelp/Using_Polymorphic_VIs/

 

It walks you through creating a polymorphic VI in Labview 7.1 

Misha
0 Kudos
Message 6 of 6
(3,291 Views)