Solved

Loading DLLs and Libraries

Posted on 1998-05-10
4
238 Views
Last Modified: 2010-04-10
What exactly is loading a library and DLL. how Do I go about doing it in C++ ?
0
Comment
Question by:unagsr02
  • 3
4 Comments
 
LVL 22

Accepted Solution

by:
nietod earned 20 total points
ID: 1175420
answer coming.
0
 
LVL 22

Expert Comment

by:nietod
ID: 1175421
Loading a library and loading a DLL is a the same thing (A DLL is a library in windows.)  You can explicitly load a DLL using the windows API procedure LoadLibrary().  This takes a single parameter that is the disk name of the DLL to be loaded.  (If you don;t specify a path, windows will look for the DLL in several directories that tend to have DLLs)  The procedure returns a handle to the DLL.  The handle is a meaningless value to your program, but you can use it as a parameter in some of the windows API procedures (It is not meaningless to windows--it identifies the DLL to windows).

continued.
0
 
LVL 22

Expert Comment

by:nietod
ID: 1175422
One important procedure you can use the DLL handle with is the GetProcAddress() windows API procedure.  This procedure takes the handle to the DLL that you loaded and  the name (or number) of a procedure in the DLL and returns a pointer to that procedure.  You can then use the pointer to call the procedure.  (Without this procedure, loading DLL's would be useless.)

Another important procedure is FreeLibrary().  When you are done with a DLL, you use FreeLibrary() to release the DLL.

I hope this helps.  Ask if you have additional questions.
0
 

Author Comment

by:unagsr02
ID: 1175423
Hello, Thanks For Your Answer... This makes it pretty clear and i accept your answer
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question