Imagine we have a solution with 2 projects: MakeDll (a dll app), which creates a dll, and UseDll (an exe app), which uses the dll. Now I know there are basically two ways, one is pleasant, other is not. The pleasant way is that UseDll link statically to MakeDll.lib, and just dllimports functions and classes and uses them. The unpleasant way is to use LoadLibrary and GetProcAddress which I don’t even imagine how is done with overloaded functions or class members, in other words anything else but extern “C” functions.
My questions are the following (all regarding the first option)
- What exactly does the MakeDll.lib
contain? - When is MakeDll.dll loaded into my application, and when unloaded? Can I control that?
- If I change MakeDll.dll, can I use the new version (provided it is a superset of the old one in terms of interface) without rebuilding UseDll.exe? A special case is when a polymorphic class is exported and a new virtual function is added.
Thanks in advance.
P.S. I am using MS Visual Studio 2008
MakeDll.libcontains a list of studs for the exported functions and their RVAs into theMakeDll.dllMakeDll.dllis loaded into the application based on what type of loading is defined for the dll in question. (e.g. DELAYLOAD). Raymond Chen has an interesting article on that.You can use the new updated version of
MakeDll.dllas long as all the RVA offsets used inUseDll.exehave not changed. In the event you change avtablelayout for a polymorphic class, as in add a new function in the middle of the previously definedvtable, you will need to recompileUseDll.exe. Other than that you can use the updated dll with the previously compiledUseDll.exe.