Re: Dynamic linking with symbols

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



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 .



Relevant Pages

  • Re: Converting Windows driver (DLL) to Linux driver
    ... > How can I convert a Windows DLL to a Linux driver. ... > in Windows assembly and it is PE Explorer generated. ...
    (comp.os.linux.development.apps)
  • Re: Work on improving/expanding HLA Adventure
    ... I find it hard to believe that the Linux OS doesn't support dynamic ... The problem is I only know the Windows specific way to load a DLL. ... I guess it would be kind of a waste if Paul plans on moving on or ...
    (alt.lang.asm)
  • Re: Linux, X, ld, gcc, linking, shared libraries and stuff
    ... >> I found something called CGwin or something, it emulates some linux on ... >> the windows plattform, but it is only reliable for source builds runs, ... This then allows you to compile Linux source code against the DLL and the ...
    (alt.lang.asm)
  • Re: Removing symbols in release build
    ... Under Linux I am able to do 'strip' of the binaries ... The only "symbols" that typically remain in an EXE or DLL are the ... library will then use the ordinals instead of the function names for ... DEF file will be very painful. ...
    (microsoft.public.vc.language)
  • Re: Converting Windows driver (DLL) to Linux driver
    ... The manufacturer is 2Wire and the driver I need is for Linux for their ... >> How can I convert a Windows DLL to a Linux driver. ...
    (comp.os.linux.development.apps)