Loading dll

Hi all,
I’m using ROOT 5.16.00 (tar.gz binaries for windows with MSVC++8.0 with debug info unpacked in same directory as ROOT sources tar.gz for the same version).

I built a dll following instructions for building a project in:
gentit.home.cern.ch/gentit/roota … Debug.html
choosing Win32 DLL Project, instead of Console Application. I also changed option: Multi-threaded DLL (/MD) to Multi-threaded Debug DLL (/MDd).

When I try to load that dll under root cint:
.L mylib.dll or with gSystem->Load(“mylib.dll”)
I get an infinite wait time after pressing enter, without nothing happening (doesn’t return to the next comand prompt nor crashes). The window title changes from ROOT 5.16.00 to ROOT session. When trying to close the ROOT window it gives me the usual: “Not responding bla bla bal — End Now?”.

Any clues or help?

Thanks all,

Though rootcint seems to have problems loading my dll in interactive mode, I’ve built an executable linking with mylib.lib (in Linker Input).
The resulting executable runs and loads dll correctly using the instruction at the begginning of main():
if (!TClassTable::GetDict(“SomeImportantClass”)) {
TString dynamicpathname(gSystem->GetDynamicPath());
dynamicpathname += "; D:\mylibpath\debug\; ";

This is a good step, but loading the dll in interactive mode still interesses me (of course). So I'd like hints on what may be going wrong when loading it in cint.
I'd like to add that my LinkDef.h file is not protected with a statement like:

#ifdef CINT


Thanks for all the patience...


I’ve found a way to load my dll under cint!
I’ve found that it only loads after processing the line:
#include "TTree.h"
All other includes are “unnecessary” (to solve the loading problem).

So it loads in my application because “TTree.h” is included before main().
What should I do to prevent this behaviour? It seems to have something to do with the dll build process doesn’t it? TTree is included in header files in the building of the dll, what else should be added?



does this work? gSystem->Load("libTree"); gSystem->Load("mylib.dll");

Thanks for the hint Axel!
It does load that way. Just as it does load if we enter #include “TTree.h” before.


could you run the dependency walker (from dependencywalker.com) and let me know what its output is? That will allow me to reproduce your problem. Alternatively you can attach your dll.


Hi Axel
I’ve run dependecy walker and I post here its output (see attached text file; I had problems sending the image file: the forum replies with: “trying to updload empty file”…).
It warned me about missing MSVCP80D.DLL . Sometimes I have problems loading a module due to the inability to load this module. I don’t quite know why sometimes it is a problem other times it isn’t. To solve this and remove this error from Dependancy Walker I’ve put the path to it in my environment variable PATH (yeah bad practice I think!). It seems to be some debug lib and it is located in $(MSVCInstallDir)redist\Debug_NonRedist\x86\Microsoft.VC80.DebugCRT
Do you suggest some other way to make this and similar annoyances disappear?
Now there is another module missing I’ve never had problems or heard about (DWMAPI.DLL) which doesn’t even exists in my PC, but doesn’t give me troubles either…

windaq_v0_DependencyWalker.txt (147 KB)

I have created a library that links to exactly the same libraries as yours, and I cannot reproduce this behavior at all. As a work-around, you could try to generate a rootmap file? You can see the here root.cern.ch/phpBB2/viewtopic.php?t=4778 how to do that. This will load the dependent libraries before loading yours.
Cheers, Axel.