[Qt-interest] QT plugins, dynamic and static version
Berry Octave
octave at octavious.servegame.org
Fri May 29 16:19:30 CEST 2009
Le Friday 29 May 2009 12:41:11 Parker, vous avez écrit :
> Hello all,
> I have an application with tabs, and I want these tabs to be generated
> dynamically, i.e. when you click a button, there will be new tab appearing,
> some other is changing, etc. So, I need to define each tab as separate
> class and load it dynamically. But what to use ? I want when the
> application is installed, if there is the need of adding additional
> functionalities, just to place one file in the program's folder and then
> the new functionality (tab for instance) to be loaded. Or something like
> that. I think I'll be able to do it with dynamic libraries, or QT plugins
> maybe ? I'm not sure what's the difference, maybe it can be done with the
> lower-level api of qt plugins OR with dynamic lybraries.
>
> Also, it is said that there are two versions of QT, dynamic and static ?
> What do this means, where I can read about it ?
>
> I'm using WIndows XP.
>
> Regards,
> Patric
>
>
> __________ Information from ESET NOD32 Antivirus, version of virus
> signature database 4098 (20090522) __________
>
> The message was checked by ESET NOD32 Antivirus.
>
> http://www.eset.com
Hi,
In fact, there are few differences between a dynamic library and a Qt plugin.
A library is used to be a set of functions that a program is allowed to use.
The difference between a static and a dynamic library is quite simple. With a
static library, the whole library code is included in the executable at link
time. Wherhas, on a dll, the code is resolved at runtime (by the linker or by
the program itself).
Qt can be built as a static and as a dynamic library. In fact, with a simple
recompilation, the programs can use both kind of libraries (beacause it's the
linker's job to do that, at compile time (for static libs) or at the program
startup).
The last case is when a program load itself a dll. I mean it has to resolve
the symbols by itself. (see man dlopen for the unix implementation as an
example).
But symbols are for example a function, not a whole class.
In order to use a dll using this way in a C++ program, you have to make some
more gymnastic, that the Qt plugins abstraction does for you.
To answer to your question, for the use you want to do, you should use Qt
plugins.
Have a look at
http://doc.qtsoftware.com/4.5/tools-plugandpaintplugins-basictools.html for
an exemple implementation.
More information about the Qt-interest-old
mailing list