Plugin DLL dependencies
Moderators: Hacker, petermad, Stefan2, white
Plugin DLL dependencies
I am still concerned about this old issue.
1) I developed a plugin which is dynamically linked to an external DLL, i.e. by LoadLibrary() and GetProcAdress().
2) This external DLL again is statically linked to an other external DLL.
The problem is that this second DLL can typically not be found by TC if it is not in TC directory, system directory, path etc. But there is simply no way to provide an plugin archive installer pluginst.inf which does a correct job. You well always see an error like "Error loading DLL".
My only workaround is to build an installer (using NSIS) to put this second DLL in system directory. I do not like it. But what else?
1) I developed a plugin which is dynamically linked to an external DLL, i.e. by LoadLibrary() and GetProcAdress().
2) This external DLL again is statically linked to an other external DLL.
The problem is that this second DLL can typically not be found by TC if it is not in TC directory, system directory, path etc. But there is simply no way to provide an plugin archive installer pluginst.inf which does a correct job. You well always see an error like "Error loading DLL".
My only workaround is to build an installer (using NSIS) to put this second DLL in system directory. I do not like it. But what else?
TC plugins: Autodesk 3ds Max / Inventor / Revit Preview, FileInDir, ImageMetaData (JPG Comment/EXIF/IPTC/XMP), MATLAB MAT-file Viewer, Mover, SetFolderDate, Solid Edge Preview, Zip2Zero and more
You did not get the point. Of course I specify the path to the first DLL. But I am not able to do so for the second DLL which statically depends on this first external DLL. That is waht all my trouble is about.
TC plugins: Autodesk 3ds Max / Inventor / Revit Preview, FileInDir, ImageMetaData (JPG Comment/EXIF/IPTC/XMP), MATLAB MAT-file Viewer, Mover, SetFolderDate, Solid Edge Preview, Zip2Zero and more
How to decide if plugin is loaded during installation or normal use? Anyway, it does not matter as second DLL is not found during neither loadings.
I am refering to lister plugins.
I already discussed this topic with ghisler some months ago. He always recommends dynamic DLL loading. But at this point I am no longer responsible for loading of dependent DLLs. Finally, our discussion stopped without results.
I am refering to lister plugins.
I already discussed this topic with ghisler some months ago. He always recommends dynamic DLL loading. But at this point I am no longer responsible for loading of dependent DLLs. Finally, our discussion stopped without results.
TC plugins: Autodesk 3ds Max / Inventor / Revit Preview, FileInDir, ImageMetaData (JPG Comment/EXIF/IPTC/XMP), MATLAB MAT-file Viewer, Mover, SetFolderDate, Solid Edge Preview, Zip2Zero and more
2tbeu
In which function do you call LoadLibrary?
In which function do you call LoadLibrary?
Last edited by Lefteous on 2007-01-18, 16:45 UTC, edited 2 times in total.
Ha, good question. I know you are referring to http://ghisler.ch/board/viewtopic.php?t=13327. Like most of my plugins LoadLibrary() is called in DLLMain(). Only exception is MAT-file Viewer plugin where DLL loading was developed together with ghisler. It is done in very first call to ListLoad() there.Lefteous wrote:In which function do you call LoadLibrary?
TC plugins: Autodesk 3ds Max / Inventor / Revit Preview, FileInDir, ImageMetaData (JPG Comment/EXIF/IPTC/XMP), MATLAB MAT-file Viewer, Mover, SetFolderDate, Solid Edge Preview, Zip2Zero and more
I do not think so. Second dependent DLL can still not be found by TC no matter where I load first DLL. It probably will work for semi-automatic installation as Listload() will not be called then.Lefteous wrote:So I guess your problem is solved by calling it in ListLoad also in this plugin right?
TC plugins: Autodesk 3ds Max / Inventor / Revit Preview, FileInDir, ImageMetaData (JPG Comment/EXIF/IPTC/XMP), MATLAB MAT-file Viewer, Mover, SetFolderDate, Solid Edge Preview, Zip2Zero and more
Surely not. OK, there will no be error message for plugin installation. However, the first time ListLoad() is called, the second DLL can not be loaded by TC. Hence, there is still no suitable workaround except proper installer which puts this second DLL on path.Lefteous wrote:Do you want to claim that ListLoad is called during installation?
TC plugins: Autodesk 3ds Max / Inventor / Revit Preview, FileInDir, ImageMetaData (JPG Comment/EXIF/IPTC/XMP), MATLAB MAT-file Viewer, Mover, SetFolderDate, Solid Edge Preview, Zip2Zero and more
- ghisler(Author)
- Site Admin
- Posts: 50479
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
Try setting the current directory to the directory of your plugin in ListLoad BEFORE calling LoadLibrary, and set it back to what it was before when the dll is loaded.
Author of Total Commander
https://www.ghisler.com
https://www.ghisler.com
By means of GetCurrentDirectory()/SetCurrentDirectory()? OK, I will test it.
Last edited by tbeu on 2007-01-18, 21:57 UTC, edited 1 time in total.
TC plugins: Autodesk 3ds Max / Inventor / Revit Preview, FileInDir, ImageMetaData (JPG Comment/EXIF/IPTC/XMP), MATLAB MAT-file Viewer, Mover, SetFolderDate, Solid Edge Preview, Zip2Zero and more
- ghisler(Author)
- Site Admin
- Posts: 50479
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
Yes, exactly! I hope that at least this will work. Another alternative would be to change the environment of your program - add the plugin directory to the PATH variable.
Author of Total Commander
https://www.ghisler.com
https://www.ghisler.com
In a quick test GetCurrentDirectory() returned the directory of the file to load. Using SetCurrentDirectory(PLUGIN_DIR) the dependent DLLs could be loaded. Seems that this solves the problem. Certainly one more hint for plugin developers! Thanks!
TC plugins: Autodesk 3ds Max / Inventor / Revit Preview, FileInDir, ImageMetaData (JPG Comment/EXIF/IPTC/XMP), MATLAB MAT-file Viewer, Mover, SetFolderDate, Solid Edge Preview, Zip2Zero and more