From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Packed Project Libraries - Passing objects into plugins

Hi,

 

I have used PPLs for simple projects before (e.g. to load measurement plugins) but now I am developing a complex application where some of the core functionality is intended to be loaded from plugins. I pretty much followed the guide on this page almost exactly (https://decibel.ni.com/content/docs/DOC-19176) and I've also read the common pitfalls article as well (https://decibel.ni.com/content/docs/DOC-20274). I'm taking an existing application where each module is a single VI called on the block diagram and trying to replace the static calls with calling them dynamically from plugins. The applications works in its current state.

 

I am able to build/load/run my plugins but am having difficulty with passing data into/out of the plugins.

 

As it currently stands, my application has:

1) A class that contains two DVRs of Variants - this is an in-house library for storing/sharing data as variant attributes distributed as a VI package

2) A couple of FGVs for storing Queue/Event references of a type definition (e.g. for reporting errors/messages)

3) A user event of a type definition (string message + variant data) (main application events - e.g. shutdown)

 

I started off with passing 3) into the plugin when it is launched and that seems to work - my plugins appear to shutdown correctly with the application.

 

My main problem is with 1)...I've tried passing the object into the plugin but I either end up with class conflicts or the reference being invalid / runtime errors. I've tried putting the class into the plugin interface but as it's a shared library / common code (which also has other classes that call it) I can't really 

 

I think I understand a reasons why this is happening - The type definitions inside the plugin are not the same as the type definitions of the application because they are namespaced within the .lvlibp. I guess the same thing happens with the classes - one is referring to the class in the executable and one is referring the namespaced version in the lvlibp.

 

Is there something I'm missing here? How do I get my object into the plugins? I don't mind if I can't get the other items (e.g. queues) as I think they're simpler to solve but the object reference is crucial to the application so is the current focus of my efforts. Do I need to pass in the 2 DVRs as they are just variants and not type-deffed and 'rebuild' the object inside the plugin or is there something else I can do?

 

 


LabVIEW Champion, CLA, CLED, CTD
(blog)
Message 1 of 3
(2,968 Views)

There are so many thoughts on this; it often seems everyone has different advice.

 

Having said that here's my fairly crude advice - put the common class into it's own plugin that your application and other plug-ins that use it can reference (including child classes, if there are any). If there are any typedefs required, put them there as well. This will be a dependency interface to the remainder of your code and won't require anything oither than the dependency namespace. Your application can easily create an instance and the plugin(s) that use said class will readily accept it.

 

You could just pass in the variant DVRs (and this would work just fine) but seems a little under-encapsulated to me. The client shouldn't know or care how said data is stored.

 

I have been where you are and it is a pain to have a "build chain" in an application that you have to manually proprogate. Rumours on the dark side indicate that R&D have been looking at "project dependencies" style of building composable applications (a. la Visual Studio and other text-based IDEs) to make generating an application from built components much simpler.

0 Kudos
Message 2 of 3
(2,950 Views)

Hello everyone,

 

I found this thread while searching for some info about the use of plugins, and I decided to attach to it instead of opening a new one since my situation has some common points with respect to the one described: I'm working on a complex program that includes some different environments, where I load user interfaces through subpanels; in particular, in one of these subpanels seeral possible UIs can be loaded, each one having the following main features:

 

- Its own queue and state machine, that can receive commands not only from the code related to the user interface but also from other parts of the application;

- Its own class and a DVR containing the class itself; however, class data have to be accessed and modified also in other parts of the application (that can't be included in the plugins I'm discussing later);

- Some graphs receiving data (through queues) from other parts of the application;

- Some controls displaying data that result from elaborations done elsewhere;

- Lots of subVI: some of them are specific of a particular user interface, some others should be shared between several different interfaces.

 

At present I statically call and execute VIs according to the UI users choose to load, everything is in the same project and is compiled and built in the same application, and it works fine; however, I'm wondering if I can get a separately-built main application and a plugin for each user interface. Plugins would be loaded dynamically inside subpanels, and would have to manage the needs I listed above. Since this is something I've never done before, I was trying to get useful instructions but I can't find elements involving my needs of heavy data communication between the plugins and the main application and plugins use as full user interfaces with their own state machine, event structure and the requirement to run continuously. Basically, I'm trying to understand if such an architecture would accomplish my requirements and what would be the best way to create it (packed libraries? source distributions? something else?).

 

I tried to click the two links containing guides in the first post, but i got a "not found" message.

 

Any advice would be appreciated.

0 Kudos
Message 3 of 3
(2,751 Views)