Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Unloading "load-time dynamic linked" DLLs

Posted on 1999-01-22
6
Medium Priority
?
285 Views
Last Modified: 2010-04-02
I have created a DLL (say A.DLL) which loads another DLL (say B.DLL) dynamically using LoadLibrary call. B.DLL loads several other DLLs (say C.DLL, D.DLL ... so on) at load time. When I call FreeLibrary in A.DLL to unload the B.DLL, the DLLs C.DLL, D.DLL, .... are not unloaded. How do I unload these libraries?
0
Comment
Question by:sridhar_dvjs
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 4

Expert Comment

by:pellep
ID: 1184829
I suggest you free c.dll, d.dll etc in the b.dll. i.e in the destructor or ExitInstance or in the
DllEntryPoint()/DLL_PROCESS_DETACH
of the b.dll you should free any library it loaded. this is can't
be done by a.dll, since you loaded the c and d.dll explicitly.

0
 

Author Comment

by:sridhar_dvjs
ID: 1184830
C.DLL, D.DLL etc.. are not explicitly loaded by B.DLL (they are loaded at load time not run time!!) The only explicit load is B.DLL and I am calling FreeLibrary to unload it.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

by:sridhar_dvjs
ID: 1184832
I thought I already rejected AlexVirochovsky's answer. The suggested code in Q10097274 can not work on WIN32. The function GetModuleUsage is absolete. All my DLLs are WIN32 and I am using MSVC 5.0 on NT 4 Sp3.
0
 
LVL 3

Accepted Solution

by:
luisr earned 20 total points
ID: 1184833
You could call GetModuleHandle("dll") and the FreeLibrary on that handle. That will unload the DLL.
0
 

Author Comment

by:sridhar_dvjs
ID: 1184834
Please refer Q.10120210
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

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…
Article by: evilrix
Looking for a way to avoid searching through large data sets for data that doesn't exist? A Bloom Filter might be what you need. This data structure is a probabilistic filter that allows you to avoid unnecessary searches when you know the data defin…
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 clear a vector as well as how to detect empty vectors in C++.

596 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