[Qt-interest] About Plugin Architecture in QT

Oliver.Knoll at comit.ch Oliver.Knoll at comit.ch
Tue May 12 16:06:06 CEST 2009


hakiim warrick wrote on Tuesday, May 12, 2009 12:33 PM:

> I've carried all dependencies( OpenCV dll's) to our plugin folder
> that resides under the "plugandpaintplugins" folder. 

That won't work: The Windows DLL loader won't have a clue that this directory is supposed to be in the PATH, so it *won't* find your extra DLLs there (note that the plugin itself is explicitly loaded by the Qt plugin framework, that is it /knows/ where to look for plugins: just in that plugandpaintplugins folder :).

> But it wont produce the dll under the plugins folder of
> "plugandpaint".. 
> I've also carried the dependencies near the exe, the exe of the
> plugandpaint, didnt work either..

Hmmm, that /should/ work. But also keep in mind that the Qt plugin framework *won't* try to reload a plugin, once it has failed to load (for performance reasons), unless its "build key" (which contains the Qt version, the settings with which Qt was build etc.) changes. These settings are somewhere persisted in the Windows registry. Try to find and delete them, maybe that helps. 

Then I remember there is some environment variable like QT_PLUGIN_DEBUG or something (check the Qt docs) which you can set, which makes the Qt plugin framework more verbose on the Console. Then either run your app from within Visual Studio (Qt Creator?) which automatically re-routes stdout/stderr to its own console, or add something like CONFIG += console to your *.pro file, so your app first opens a console before starting.

Then off course there are several other ways/places where to put DLLs, so that the Windows dynamic linker can find them: maybe that helps, too:

  Dynamic-Link Library Search Order:
  http://msdn.microsoft.com/en-us/library/ms682586.aspx

For example, you can also add extra "search paths" when your *.exe starts in the registry (typically done during install time):

  http://www.tech-pro.net/intro_reg.html

(Search for "Search Paths") - These are (temporarily) added to the PATH when your *.exe starts, so Windows looks in these folders as well for DLLs (useful if you want to put all your DLLs into a "Lib" subdirectory, for instance, or a lib directory which is shared by several applications).

But IIRC I read somewhere even on MSDN that this ("Search Path") is bad, outdated and not the way to go anymore... ;) But still I see also newer programs still registering their "search path" in the registry. For example GIMP 2.6 as well (recent application), and even Excel 2003 (which admitelly IS somewhat old by now ;). See HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths


Good luck, Oliver
-- 
Oliver Knoll
Dipl. Informatik-Ing. ETH
COMIT AG - ++41 79 520 95 22



More information about the Qt-interest-old mailing list