What "mapping" is all about?
-
Hi all: I've heard a lot terms which talks about "mapping", but my question is in the case of dll mapping what the heck “mapping” means here? My guess in general in this scenario is that, OS first load the dll from disk to memory, and this way makes the dll has addresses, and when an executable wants to use this dll, the OS simply make a address translation mechanism in which by using the specific address contained inside executable address space itself this dll can be accessed or called, it is just a process of address translation from address in executable to dll address. If this assumption is true, how about dynamic loading, what happened to GetProcAddress()? Just get a address inside executable? And I believe this assumption applies to all the situations that I can think of in which "mapping" is involved.
-
Hi all: I've heard a lot terms which talks about "mapping", but my question is in the case of dll mapping what the heck “mapping” means here? My guess in general in this scenario is that, OS first load the dll from disk to memory, and this way makes the dll has addresses, and when an executable wants to use this dll, the OS simply make a address translation mechanism in which by using the specific address contained inside executable address space itself this dll can be accessed or called, it is just a process of address translation from address in executable to dll address. If this assumption is true, how about dynamic loading, what happened to GetProcAddress()? Just get a address inside executable? And I believe this assumption applies to all the situations that I can think of in which "mapping" is involved.
-
Sorry, if the question is unclear, Just to reiterate, in short what "address mapping" means and does my previous assumption about it right.
Your assumption is correct. This is what happens when an executable calls a function from a DLL directly. With "GetProcAddress()", the DLL is loaded to memory (and mapped to addresses) when you call "LoadLibrary()". After the DLL is mapped, the call to "GetProcAddress()" will return the address that is mapped to that specific function. Hope this answers your question ... :)
-
Your assumption is correct. This is what happens when an executable calls a function from a DLL directly. With "GetProcAddress()", the DLL is loaded to memory (and mapped to addresses) when you call "LoadLibrary()". After the DLL is mapped, the call to "GetProcAddress()" will return the address that is mapped to that specific function. Hope this answers your question ... :)