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

x
?
Solved

Why does a dll have unresolved unlike lib ?

Posted on 1999-06-24
6
Medium Priority
?
285 Views
Last Modified: 2010-04-02
Why does a dll have unresolved unlike lib ?
what if the symbols are resolved in a different Dll ?
0
Comment
Question by:hed
[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
  • 3
6 Comments
 
LVL 22

Accepted Solution

by:
nietod earned 160 total points
ID: 1198356
What do you mean?  A DLL cannot have unresolved symbols.

A DLL can use symbols that are provided by a different DLL.  But to do so it must link with that DLL's export library file (.lib).   A DLL's export library resolves the symbols defined in the DLL.
0
 

Author Comment

by:hed
ID: 1198357
i mean a lib can settle for the .h files.
does the dll linkage different ?
what if i supply the dll for the resolution a static lib ?
does it link that lib inside ?
what if i wanted to link a dll + a static and that dll would resolve the symbols that static contain only when it is linked to the executable ?
0
 
LVL 22

Expert Comment

by:nietod
ID: 1198358
>>i mean a lib can settle for the .h files.
What do you mean by that?  What does "settle" mean?  I can think of no way in which these two file types are even related.

>> does the dll linkage different ?
Different than what?

>> what if i supply the dll for the resolution a static lib ?
Are you talking about compile and DLL or a static lib?  When you compile a DLL you can supply static librarys do help it resolve its symbols.  In fact you must, as the DLL must be linked to some of the OS static librarys, like kernal32 and user32.  

>> does it link that lib inside ?
what lib?  when?
Are you asking if a static lib can be linked into a DLL?  Yes.  All the time. Sometimes though a static lib only resolves symbols for link time but not run-time.  This happens when the static lib is the export library from a DLL.  Thus there are two types of static libs, ones that "really" resolve the symbols and ones that resolve them for linking, but require that a DLL be found and used at run-time.  (Actually there is only one type of static lib, but it can be used in either of two ways.)

>> what if i wanted to link a dll + a static and that
>> dll would resolve the symbols that static contain
>> only when it is linked to the executable ?
No the symbols of the static library would be resolved in the DLL at link time.  They would not be resolbed in the executable that uses the DLL EVER.  The static library is being linked to the DLL, not to the executable.
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

Author Comment

by:hed
ID: 1198359
I"ll try to ask clearly.

I have "A" as static lib and as a dll. "A" uses static lib "B".
when i compile "A" as static i don't need supply "B"
when i compile "A" as dll i need supply "B"
( ? is that true ?)


I have as well "C" that uses "B"

An executable that is built of "A","C" as dll would contain duplicated code of "B" that each of the dll embeded into it.  ( ? is that true ?)


A DLL is more like an executable than like a lib in that it needs to resolve (one way or another) during linkage all the symbols. ( ? is that true ?)

any resources on this subject ?
0
 
LVL 22

Expert Comment

by:nietod
ID: 1198360
I see

>> ( ? is that true ?)
Yes and no.  If you compile A as a DLL yes you need to supply "B" because all symbols must be resolved in the DLL.  If you compile "A" as a static library (not an export library, which is also a static library, but one created when you compile as a DLL) then no you don't need to specify "B" at that time, but eventually, when "A" is linked into the final EXE or DLL "B" will need to be specified then.  Either way, "B" is eventually specified.

>> I have as well "C" that uses "B"

>> An executable that is built of "A","C" as dll would
>> contain duplicated code of "B" that each of the dll
>> embeded into it.  (? is that true ?)
Assuming "B" and "C" are statics, not the duplicate code should be stripped out.  This is important because some languages, like C/C++ require that you be able to compate pointers to procedures to see if two procedure pointers point to the same procedure.  If seperate modules contained seperate copies of the same  procedure, they would have different addresses and the comparisons would fail.  (C/C++ meerly says that this comparison must work, it doesn't say how.  So an implimentation could have the seperate copies if it could figure out how to make the comparison still work.  In practice it is always done by removing the copies, since that is by far the easiest way to make it work.)

>> A DLL is more like an executable than like a
>> lib in that it needs to resolve (one way or another)
>> during linkage all the symbols. ( ? is that true ?)
Yes.  In fact the two have the exact same format, only 1 or two fields in the EXE/DLL header are set differently to indicate which is an EXE and which is a DLL.  Both are fully resolved object files.  
0
 

Author Comment

by:hed
ID: 1198361
Adjusted points to 40
0

Featured Post

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

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

What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
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 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.

660 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