Auto append of .dll for a gSystem->Load

Gordon Watts (gwatts@fnal.gov)
Tue, 14 Oct 1997 22:47:25 -0500


Hi,
I'm observing some funny behavior when I load a dynamic library, so I
started looking at the source code. Thus, this email:

1) In WINNT_WinNTSystem.cxx, in the routine DynamicPathName there is the
following code which is used to auto append ".dll" onto a string (a great
idea, from the portability point of view):

if (!strchr(lib, '.')) {
name = Form("%s.dll", lib);
name = gSystem->Which(GetDynamicPath(), name, kReadPermission);
}
else {
int len = strlen(lib);
if (len > 4 && !(strnicmp(lib+len-4, ".dll",4)))
{
name = gSystem->Which(GetDynamicPath(), lib, kReadPermission);
}
else {
::Error("TWinNTSystem::DynamicPathName",
"DLL library must have extension: .dll", lib);
name = 0;
}
}

I think this doesn't take into account relative paths. A filename like
"../eejj_ntuple_objects/eejj_ntuple_objects" will fail that first if
statement, where it really shouldn't... (I need to use relative paths
because I'm always moving between various machines).

2) Second, I've observing a very strange behavior. I have a .dll that is
several directories away from my current location in root. I would like to
do something that looks like this:
"gSystem->Load("../eejj_ntuple_objects/Debug/eejj_ntuple_objects.dll");"
but that fails. However, if I copy the eejj_ntuple_objects.dll into my
local directory, or invoke root while sitting in the directory where
eejj_ntuple_objects.dll resides it works. Further, another .dll does load:
gSystem->Load("../../mass_fitter/Debug/mass_fitter.dll")" The sucess or
failure is indicated by the return value of the gSystem->Load routine. Have
others seen something like this? I can try to put together a test case, but
I don't really understand this error enough...

3) Is it possible to unload a DLL? I have a large ntuple file (many
columns) converted to a root file. It takes over a minute to open and load
in the ntuple on my 133 MHz, 40 meg pc and I would like to just leave root
up and going and then load and unload the DLL I'm testing (I can't run the
DLL in the interpreter: there is a lot of FORTRAN source code involved...
bummer.).

Thanks for your help, and sorry to "mail bomb" this list.

Cheers,
Gordon.