Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How to avoid loading 3rd party DLL?

Posted on 2002-03-15
5
Medium Priority
?
263 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 800 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

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

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

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…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
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 user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

783 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