Re: dlls on nt

Valery Fine (fine@bnl.gov)
Thu, 27 Aug 1998 19:55:42 -0500


Dear Chris
On 27 Aug 98 at 19:03, you wrote:

> I was wondering if there exists a listing of all the functions
> and
> their names that are contained in the root dlls included in the root
> release.

Yes, just print the list of the library you are asking about.
(Root_Base.dll for your case). Under Windows one may apply the
DUMPBIN utility with /EXPORTS option.

DUMPBIN /EXPORTS Root_Base.lib

> I am trying to call root i/o functions from another
> program, and i am getting back my error for inability to find the
> function. i can tell it is loading the dll and linking to it, but
> it can't find the name of the function. I'm not sure if i am doing
> it right, so here is the basic code (C++)
>

The code you supplied is "C" not "C++".

> root is the name of the dll, and i believe that i just can't get the
> address for the Write function. (if it exists, gosh, i could be
> linking to the wrong dll) i am linking to Root_Base.dll
>

Why you don't want just to call what you want. If you have
object let's say "obj" to call its "Write" method you should "say"

obj->Write();

The C++ run-time system will make the rest job for you.

DLL is created by compiler /linker. At this time there is no
object. The object is created by the user code at Run-time.

Since there is no object - there is no address for its Write method
too within any DLL. So one can not find in DLL that address because
it is NOT there at all.

Well you may say I want to find not method of some object but
the definition of the member-function "Write" for class "B" for
example. Sometimes is might make sense. But this way you should be
able to say "give me method "Write" of class "B". Just "Write" is not
enough since DLL may contain many "Write()". Even a single class may
have ANY number of the different "Write's". This means even telling
"member-function Write() of Class "B" is not enough to define what
you want. You must say WHICH "Write" of class "B" you do need.

Now let's assume you have managed out everything and found the
address of that member-function. What can you do with that pointer ?
To call some method via that pointer one still must supply the
pointer to the OBJECT as the first argument of that "Write" function.

At this point I would advice you to read some C++ documentation
about how the library entry names of the class method are generated.

If you are curious you may see these names via "dumpbin" utility of
Microsoft SDK (under UNIX you may apply "nm" to get the same result)

> if (root != NULL)
> {
> write_pointer = (LPFNDLLFUNC1)GetProcAddress(root,"Write");
> if (!write_pointer)
> {
> // handle the error
> FreeLibrary(root);
> return 2;
> }
> else
> {
> // call the function
>
> uReturnVal = write_pointer(from_java);
> return 1;
> FreeLibrary(root);
> }
> }
>
> any ideas would really be appreciated.

Yes, please, read the "Online help" Microsoft supplies. It is
provided with very powerful search engine. If you could not find
the answer with "on-line docs" you may regard to use the Microsoft
"knowledge base" too:

http://www.microsoft.com/kb

If you have question related to very ROOT DLLs and ROOT
classes send you question/bug reports/advices to

mailto:rootdev@root.cern.ch.

If you think your question is a general for ROOT community interest
you may ask assistance from the

mailto:roottalk@root.cern.ch

E-mail list too.

Hope this helps,
With my regards,
Valery
>
>
> chris
> chris garcia
> cdf group, the ohio state university
>
=================================================================
Dr. Valeri Faine (Fine)
------------------- Phone: +1 516 344 7806
Brookhaven National Laboratory FAX : +1 516 344 4206
Bldg. 510A /STAR mailto:fine@bnl.gov
Upton, New York, 11973-5000 http://nicewww.cern.ch/~fine
USA

Dr. Valery Fine Telex : 911621 dubna su
-----------
LCTA/Joint Inst.for Nuclear Res. Phone : +7 09621 6 40 80
141980 Dubna, Moscow region Fax : +7 09621 6 51 45
Russia mailto:fine@main1.jinr.dubna.su