I wanted to have a go at building an application using a plugin architecture so I built an application that dynamically calls VIs inside packed library files (.lvlibp). The application on the whole worked great except for one problem - obtaining a named queue inside my plugin gives error 1094.
In my application, I have a daemon which runs and a series of wrapper VIs that push commands into the daemon using a named queue. In the top level VI, I initialise and launch the daemon and the plugins are supposed to be able to communicate with it using the wrapper functions (by obtaining the named queue). Except that I get error 1094 - I think I know the reason for this and that's because the typedef that the queue is created from is namespaced differently in the plugin (Plugin.lvlibp:Typedef.ctl) as opposed to the main VI (Typedef.ctl) - even though they are both generated from the same file. The typedefs both use the same control - just that one is built into the lvlibp and one is referenced directly by the main VI (or part of the built executable?)
So - the question is, how can I obtain a queue by name within a dynamically called VI in a packed library? Passing in the queue reference isn't really an option as the daemon already exists as an API and I believe it should be possible (somehow?) without having to modify that.
I have attached a simplified example in LV2012 that demonstrates the problem - the Main VI creates a queue from a typedef which the Plugin VI tries to obtain a reference to and fails with Error 1094. This is slightly different to my application as in the example I could just pass in the queue reference to the Plugin VI when it is launched, but I can't really do that in my actual application (Imagine a VI that obtains the queue reference for you that you use in both the Main VI and the Plugin VI).
I have found a solution for my application (to use the User event to pass the data back up to the Main VI) but I really want to see if there is a more elegant solution!
Thanks in advance!
It seems as though this issue is due to the fact that when the packed library is built, any type-defined controls will inherit the lvlibp namespace and create a new "unique" type definition within the packed library. I believe you should be able to access the queues if you select the "disconnect type definitions" option when the library is built.
Thanks for your reply.
I tried disconnecting the typedef from the lvlibp file but I still get the same error 1094 when running in LabVIEW. It did, however, work correctly when I built my Main VI into an executable and disconnected the typedefs.
This means it would probably work for my built exectable but there is one key problem here - It will make the software difficult to debug as I won't be able to run/test the plugins in the development environment (I could perhaps do a conditional to load the VI directly in the development environment rather than the VI inside the lvlibp but it's not a 'real' test if I do it that way.
I just want to give this thread a new try because I have the same problem and no good solution.
Even a variant queue with the identical variant constant is producing the above error.
Is there anybody out there who grew up in the last years and now has a solution ??
Create an interface PPL that contains your typedefs. Have your main application and the other PPLs reference that one single interface PPL. That way everything will be using the same name space. You do need to make sure that the library PPLs (all of your base class definitions, types, interface PPLs) are referenced from a common location. We use a directory in the ProgramData folder for this purpose. Placing them in user.lib in the NI folders would also work.