LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Multiple lvclass instances

Hi all,

 

I have a project that requires upto 4 instances of the same lvclass driver (plugin application). Is this possible to do in LabVIEW 2012?

 

Regards

 

Matt

0 Kudos
Message 1 of 4
(2,831 Views)

Yes, of course it is. You can use as many instances of any given class as you want. If any of the VIs in that class store data inside the VI using an uninitialized shift register, then you'll need to make those VIs reentrant.

 

For a plug-in architecture, a common system is to load the class from disk when needed using Get LV Class Default Value VI. You can call this as many times as you want to get multiple instances. You'll then need to cast them, using To More Specific Class, to a parent class that is statically linked to the VI. While the wire will be the parent class type, at run-time it will call the child class' methods (the class that you loaded from disk).

0 Kudos
Message 2 of 4
(2,822 Views)

multi plugin.JPGThanks for the responce,

 

Is this what you meant by  "You can call this as many times as you want to get multiple instances"

0 Kudos
Message 3 of 4
(2,729 Views)

matt26 wrote:

Is this what you meant by  "You can call this as many times as you want to get multiple instances"


I'm not sure what you're asking. Does this code do what you need it to do, and work the way you expect?

 

To save some duplication, you could also put most of this code into a for loop to get an array of four objects, and then index them out and cast them to the correct type.

0 Kudos
Message 4 of 4
(2,713 Views)