Solved

How to avoid loading 3rd party DLL?

Posted on 2002-03-15
5
230 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

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…
C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

911 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

15 Experts available now in Live!

Get 1:1 Help Now