Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How to avoid loading 3rd party DLL?

Posted on 2002-03-15
5
Medium Priority
?
260 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
[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
  • 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

Enroll in September's Course of the Month

This month’s featured course covers 16 hours of training in installation, management, and deployment of VMware vSphere virtualization environments. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
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++.

730 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