Solved

How to avoid loading 3rd party DLL?

Posted on 2002-03-15
5
226 Views
Last Modified: 2010-04-01
I program in Visual C++ version 6 on Windows NT 4.  A third party provides a DLL, a link-time library to go with that DLL, and a header file.  Whenever I link my program to the 3rd party library, my program will demand the presence of the DLL at startup, regardless of whether or not my program actually reaches any function calls to the 3rd party library.  I want to avoid installing the DLL in all the computers around the world that run my software.  I want to limit distribution of the DLL just to those computers that need its functionality.  I do not have the source code for the DLL or the 3rd party link-time library, and the 3rd party has so far been uncooperative in helping me achieve my goal.  Do I have any way out?

Thanks,
     - David
0
Comment
Question by:dwhite494
  • 3
5 Comments
 
LVL 86

Accepted Solution

by:
jkr earned 200 total points
ID: 6869506
>>Do I have any way out?

Yes - use the "/delayload" liker option, e.g.

/delayload:3rdparty.dll
0
 
LVL 86

Expert Comment

by:jkr
ID: 6869515
BTW, to elaborate: This option will cause the DLL to be loaded only when it is needed, i.e. the 1st time a function of the DLL is being called. Just add the above statement to your linker options for your project.

0
 
LVL 1

Expert Comment

by:allym
ID: 6869559
Another way is not to link with their .lib file, but pull in the DLL with the LoadModule() API call and then get the address of the function(s) you use with GetProcAddress().
However, the linker option is much easier to use as you won't have to modify your code.
0
 

Author Comment

by:dwhite494
ID: 6869858
Mr./Ms. "JKR" continues:
BTW, to elaborate: This option will cause the DLL to be loaded only when it is needed, i.e. the 1st
time a function of the DLL is being called. Just add the above statement to your linker options for
your project.
0
 
LVL 86

Expert Comment

by:jkr
ID: 6870219
"Mr." is OK :o)
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

706 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