09-12-2013 02:19 PM
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
09-12-2013 03:17 PM
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).
11-19-2013 10:20 AM - edited 11-19-2013 10:26 AM
Thanks for the responce,
Is this what you meant by "You can call this as many times as you want to get multiple instances"
11-19-2013 10:31 AM
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.