Re: Dynamic linking with symbols
- From: Philip Lawatsch <philip@xxxxxxx>
- Date: Wed, 31 Aug 2005 14:33:00 +0200
Arnaud Debaene schrieb:
Philip Lawatsch wrote:
2) When you "directly" call a method in a DLL (say you've linked with it's import library), you're going through the DLL export table, which contains the fixed addresses fort the DLL' exported symbols (this table is created by the loader when the DLL is loaded, based on the export offsets within the DLL and the DLL base address). So, whichever way you take, you've basically the same overhead (an indirection through a "function pointer" of some sort). This indirection is a direct consequence of the *dynamic* linking feature of DLLs, which means you *can't* know the address of the DLL's symbols until runtime.
Really? So in Windows you always go through the stub? Ok, I didnt know about this. Is there any good reason for this?
Well, first I believe it's about the same story with Unices' .so, which are based on the same principle (the main difference is that .so export *all* their symbols).
It all boils down to the fact that you cannot not where the DLL (or .so) will be loaded in the process address space (it's called the base address of the DLL) until it is effectively loaded. This base address depends of how the process address space is filled when the DLL is loaded (basically, the loader looks for a big enough chunk of free memory in the process address space where to put the DLL image). Therefore, actual resolution of the symbols' addresses is postponed until runtime (that is what is called "late binding")
Just read further into the subject and yes, you're right. I though that by not using lazy binding when using the shared lib I could get around using the PLT in Linux. This is wrong however, so I also have an extra dereference in Linux.
kind regards Philip .
- References:
- Dynamic linking with symbols
- From: Philip Lawatsch
- Re: Dynamic linking with symbols
- From: James Brown
- Re: Dynamic linking with symbols
- From: Philip Lawatsch
- Re: Dynamic linking with symbols
- From: Arnaud Debaene
- Re: Dynamic linking with symbols
- From: Philip Lawatsch
- Re: Dynamic linking with symbols
- From: Arnaud Debaene
- Re: Dynamic linking with symbols
- From: Philip Lawatsch
- Re: Dynamic linking with symbols
- From: Arnaud Debaene
- Re: Dynamic linking with symbols
- From: Philip Lawatsch
- Re: Dynamic linking with symbols
- From: Arnaud Debaene
- Re: Dynamic linking with symbols
- From: Philip Lawatsch
- Re: Dynamic linking with symbols
- From: Arnaud Debaene
- Dynamic linking with symbols
- Prev by Date: Re: Dynamic linking with symbols
- Previous by thread: Re: Dynamic linking with symbols
- Next by thread: Re: Dynamic linking with symbols
- Index(es):
Relevant Pages
|