Solved

Loading DLLs and Libraries

Posted on 1998-05-10
4
234 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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
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.

762 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now