PDA

View Full Version : Plugin Architecture



jtaylor108
4th April 2008, 07:30
Hi all,

I've managed to get Qt plugins working successfully, but I'm having a problem with the overall architecture.

I have a main app that uses (includes/depends on) our engine code and a series of Qt plugins loaded by the app that also use the engine code.

The problem is that this seems to result in the app and the plugins each having their own instance of the engine, whereas there should only be one instance of the engine (otherwise engine objects created by the plugins won't be recognized by the app's engine).

Is there any way to achieve an engine system common to the app and the plugins it loads?

TIA,

jt

wysota
4th April 2008, 08:08
You can export the engine to a separate library and link each plugin against the library. Or you can place the engine in the main application and have a pointer to it somewhere so that plugins can take it and use it. It depends whether you want each plugin to have a separate engine or if they can all share a single instance of it.

jtaylor108
8th April 2008, 06:32
Many thanks for such a prompt reply :)

Using VS2005, I'm building the engine as a library (a '.lib' static library file) and the app and plugins are both linking against this. I would like the app and plugins to share a single instance of the engine, but this doesn't seem to be happening. However, the plan now is to rewrite the engine as a dll so I'll see how that works once it's been done.

Again, many thanks for the help - it's much appreciated.

Cheers,

jt