Re: Auto append of .dll for a gSystem->Load

Valery Fine (fine@mail.cern.ch)
Wed, 15 Oct 1997 13:19:38 +0100


On 14 Oct 97 at 22:47, Gordon Watts (Brown Universit wrote:

> 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.

Hello, well it seems to me there is some problem with
WinNTSystem::GetDynamicPath() or Which( . . . ).

> 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.).

As you probably realized from the code ROOT doesn't define any
special method to Load/Unload DLL and applies CINT API for that.
(It is managed from the TSystem class with no overloading).
So TSystem::Unload(.. ) should be changed as follows
(where G__unloadfile belongs CINT API).

//______________________________________________
void TSystem::Unload(const char *)
{
// Unload a shared library.
#ifdef NOCINT
AbstractMethod("UnLoad");
#else
char *path;
int i = 1;
if (IsAbsoluteFileName(module))
i = G__unloadfile((char *)module);
else if (path = DynamicPathName(module)) {
char *s = ConcatFileName(path, module);
i = G__unloadfile(s);
delete [] path; delete [] s;
}
#endif
}

What is worse at present (for last 3 months) I neither belong
ROOT developers team nor even ROOT users, just a reader of this list
and can make no promise to fix this myself soon, sorry.

Valery
Dr. Valeri Faine (Valery Fine)
------------ ------------- Phone: +41 22 767 4921
CERN FAX : +41 22 767 7155
CH-1211 Geneva, 23 mailto:fine@mail.cern.ch
Switzerland http://nicewww.cern.ch/~fine