Just completed watching a fantastic video on CppCon CppCon 2017: James McNellis “Everything You Ever Wanted to Know about DLLs” This cleared my concepts about what DLLs are and what purpose they hold. But still there are few things I'm not very clear about.
At 21:34, James McNellis was saying something "Magic" but didn't actually discussed about it. He also explained what happens when we load Hello.dll not much in detail but still satisfactory. Now let's come to my Question, How DLL is loaded into memory?
Let's say I have Hello.cpp which calls somefun() from Hello.dll, Now when we compile and link our program, Hello.exe must have call instruction to somefun() which of course need a memory address. What will be this address? Will it be RVA from preferred base address of DLL? If yes then what if DLL is loaded somewhere else other than preferred address.
How DLL symbols are mapped into executable? Does Windows change every address inside executable to do this? Also what was that "magic"?
Sorry if my question doesn't make sense. Thanks in advance!