tags:

views:

1224

answers:

2

What is the difference between Load-time dynamic linking and Run-time dynamic linking? Thanks!

+1  A: 

You forgot the "homework" tag.

Load-time linking means that the DLL you're linking to is loaded when your application starts, regardless of whether or not you actually use the functionality in that DLL. Dynamic linking means that the functionality of the DLL is only loaded when it's actually needed.

Ken White
+3  A: 

Load-time Dynamic Linking

When an executable is linked to a DLL at build time the linker will not insert object code but rather it insert a stub which basically says a function of this name is located in this DLL.

Now when the executable is run, bits of the executable will be missing (i.e the function stubs) so before the program is allowed to run the program loader fixes up these missing functions by replacing them with entry points into the DLL files.

Only after all the stubs have been replace (i.e resolved) will the executable be allowed to run.

That is load time dynamic linking.

Run-time Dynamic Linking

In this case the executable was not linked to any DLL library file, so it will not contain any stubs into the dll and as such the program loader has no issue running the executable.

But the task of getting access to the function from with-in the DLL is left to the executable and can be done using the GetProcAddress Windows API.

That is run time dynamic linking.

jussij