LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

build applications with dynamic loaded subVI's as dll

I want to build an application with some subVI's. The target would be to have an *.exe from the topVI and a seperate file for every subVI (I suppose this will then be a *.dll file)

The topVI uses the "call by reference node" with a "type specifier VI refnum" reference.

The path of the subVI's is read from a textfile and the subVI's are called dynamicly, all subVI's have the same connector layout.

Until now I was not able to generate a *.exe file wich is able to dynamicly call subVI's which are not included in the *.exe file (I tried with *.vi, *.llb and *.dll versions of the subVI's).

Building this application with all subVI's included in the *.exe is no problem and works fine, but is not what I want.

The target would be to have the possibility to update only some subVI's without the need to build the whole application again.

This way of working would increase the flexibility to have different combinations of versions a lot.

 

I am using LV8.2.

 

Is my question anyway possible and if yes can somebody tell me how?

 

Thanks!

0 Kudos
Message 1 of 9
(3,591 Views)

I don't see how you could possibly load a subVI as a dll. That just does not make any sense.

 

Loading a VI or a VI in an llb should be no problem. Are you using the Current VI's Path function and are you aware that it will return a different path when you build the executable? You have not provided much information except that the exe does not work. What kind of error code is generated when you try to load an external VI?

Message 2 of 9
(3,577 Views)

Hello,

 

A SubVI is actually what you call a sub-routine in text-based programming languages.
So when you build an executable from a VI with SubVI's, it will simply build everything into one exe file.

That's normal behaviour.

 

If you would like to use dll's for flexibility, than you have to build VI's seperately for every dll you want to build.
These dll's can than be called from within you main application executable.
This practice is often used by system integrators to protect there code otherwise than a larger executable, but mainly because of easy maintenance.

That is what I think you are also looking at.

 

So what you would like to do is perfectly possible and common practice, you may only have to change your top view of the actual application.

Best regards,
Joeri

National Instruments
Servicesg
Message 3 of 9
(3,562 Views)

Thanks Joeri,

 

this is indeed what I want to have.

Now my problem is still how do I call these subVI's (which are now *.dll files) from the main application?

In my current topVI I use the "call by reference" but this only works with *.vi files and not with *.dll files.

So how can I call *.dll subVI's and also connect some inputs and outputs to the connector of this subVI.dll ?

 

Thanks,

0 Kudos
Message 4 of 9
(3,522 Views)
You call a dll with the Call Library Function Node. A dll does not have a 'connector'. It has parameters an the parameters are defined in the .h file that is created at the same time as the dll. You also have to specify the function in the dll that you want to call. Each VI that you include in the dll build is a separate function. There are examples for calling a dll.
Message Edited by Dennis Knutson on 04-15-2009 03:25 PM
Message 5 of 9
(3,503 Views)

In the mean time I am able to call *.dll files. Thanks for this. But still I don't know how to dynamicly call *.dll files.

Currently I use the  the "call by reference node" with a "type specifier VI refnum" reference, meaning I give the path of a VI to this "call by reference node" and this calls the given VI.

By using the "type specifier VI refnum" I specify the connector layout of the VI's I want to call.

 

Now I would like to do the same thing with the *.dll files.

Then I have a lot of *.dll files which all have the same parameters and all contains a function with the same name (offcourse different functionality).

This should make it possible to specify a "type specifier DLL refnum" and have a fixed connector layout with fixed connections for the "call library function node".

Then in the same way I would give a path to the "call library function node" to load the correct *.dl.

 

With the standard "call library function node" this seems not to be possible, there is no input to connect a path nor a property to set the path programmatically.

Is there an "advanced" version of this node available or how can this be done?

 

 

0 Kudos
Message 6 of 9
(3,431 Views)

You actually have some options if you want to call sub VIs dynamiclly. This is also true if you have created an exe file. If you have test system compiled to exe file, you may add test ruotines as exstrenal VIs much in the same fashion as you do with DLLs. I suppose that is something like that you want to do, and some terms has been mixied. For more information on this topic search the labview help for "Dynamically Loading and Calling VIs". For example use the find example function and search for dynamic load.

Good luck



Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
(Sorry no Labview "brag list" so far)
0 Kudos
Message 7 of 9
(3,413 Views)

I think this is getting confusing. We are actually talking about two different things:

1) calling dll's from a LabVIEW exe (LV dlls or others)

2) calling external vi's dynamically from a LabVIEW exe

 

I've done quite a bit of both of these (but only with VI's included with the exe for the second). I believe the ability to specify the path to the dll on the Call Library Function Node was added with LV8.5, so you might be outta luck there. I think you could achieve the same effect with a wrapper library, but that would have to be coded outside LabVIEW. I think #2 is what you were talking about originally, and I don't see any reason why it wouldn't work. As Dennis mentioned, you need to be aware of how the current VI's path changes when it is part of an exe, but other than that, I don't see an issue. I haven't tried it though, so I'm not sure.

 

Chris

0 Kudos
Message 8 of 9
(3,400 Views)

The ability to specify a path to a dll would be a good reason to upgrade. Functionally, there's not a lot of difference between dynamically calling a VI or a dll.

 

0 Kudos
Message 9 of 9
(3,394 Views)