Skip to main content
Inspiring
August 13, 2022
Question

Where to put additional DLLs for plugin?

  • August 13, 2022
  • 4 replies
  • 2611 views

Hello, I am developing a C++ plugin using a third-party library (Qt). While developing I put the necessary DLLs into the photoshop.exe folder. But where must I put them when I install my plugin on the user's PC?

Are there some photoshop-only search paths? I do not want to register those DLLs on PATH environment variable because then they will be visible to every program and may lead to DLL-hell on the user's PC.

Is there any solution?

This topic has been closed for replies.

4 replies

Inspiring
August 14, 2022

Did you try placing qt DDLs in either root of photoshop (where exe is) or next to your plugin in the plugins folder?

OlegGAuthor
Inspiring
August 14, 2022

I tried placing Qt DLLs in Plugin's and Photoshop's folders. Works only Photoshop's root folder. So I assume Photoshop doesn't adds Plugins folder to search paths (by AddDllDirectory) before loading plugins.

Inspiring
August 14, 2022

I don't think he does explicitly. 

When I made plugin system and my sub plugins used qt stuff placing Qt dlls inside root folder was enough.

 

There is however a path for Qt that you can add. Something like QApplication::addLibraryPath or something like that. 

Perhaps adding it in your main could help it... however not sure how would he be able to call it without qt dll hmmm... Maybe have a look at the source on > https://code.woboq.org/qt6/ and see how they do it & implement it manually in your main? Perhaps it will be enough to make qt work.

 

Let me know how it goes as I also want to stuff Qt inside photoshop.

 

How are you using Qt so far? How do you deal with threads/notifications? Does it run in parallel to photoshop or only during a specific action widget pop-up?

 

Another solution is to do a nested plugin.

photoshopPluginA

logicPluginA

 

photoshopPluginA essentially will just load dll and add paths to search dir.

It will then load logicPluginA(which uses qt/etc) and then forward all requests to logicPluginA.

 

I know it's a "Bad" idea, as plugin-loads-plugin, but maybe it would work.

 

In that config, you could even specify a global location for Qt/other dlls, like server shared folder. So maybe its a good solution for pipeline needs...?

 

 

Regards

Dariusz

Jeff Arola
Community Expert
Community Expert
August 13, 2022

I believe adobe suggests installing third party plugins along with the nessacary dll files into

 

windows

C:\Program Files\Common Files\Adobe\Plug-Ins\CC

 

As an example adobe includes dll files with the camera raw install and another example is the gmic plugin for photoshop

https://github.com/0xC0000054/gmic-8bf

 

OlegGAuthor
Inspiring
August 13, 2022

Hello, Jeff

I checked Camera Raw plugin and it looks like it explicitly linked with those dlls (loads them with LoadLibrary function) - I cannot find those dlls in dependency list.

But Qt links implicitly (at compile time). So I cannot point Qt where to search its dlls dynamically. And in this case, I can only put Qt dlls at one of photoshop's search paths to make them visible to it. And if photoshop does not use something like SetDllDirectory or AddDllDirectory  I can only use one of the paths that are visible to every installed application (PATH environment, system, or windows folders) or use photoshop.exe path.

Jeff Arola
Community Expert
Community Expert
August 13, 2022

Did you look at the gmic plugin for photoshop

 

https://github.com/0xC0000054/gmic-8bf

Legend
August 13, 2022

Maybe put them with the plugin but load the DLL specifically with LoadLibrary. 

OlegGAuthor
Inspiring
August 13, 2022

Thanks for your reply. Unfortunately, it is not practically possible with the Qt library.

Inspiring
August 13, 2022

+1 from me too, where where where?