tags:

views:

51

answers:

4

I know that dynamic link library are loaded in memory when an application loaded, the reference is resolved by operation system loader. For example, in windows kernel32.dll, user32.dll and gdi32 dll, so if my application reference a function in a kernel32.dll, for example CreateWindow, is that the whole dll must be loaded in the process, or just part of the dll?

Thanks

+1  A: 

You reference one function, you get the whole DLL. You can't load just part of a DLL.

It's annoying because you get all of Shell32.dll just to find where someone's home directory is. Sigh.

jeffamaphone
+2  A: 

whole thing, but don't worry, it's not re-loading the dll over and over, there is one instance for all the programs that use it....another name for dll is so....or shared object, and that's the whole point, to share.

http://en.wikipedia.org/wiki/Dynamic_link_library

Chris H
A: 

Only the functions you use in that DLL is required, do not worry about cramping the memory, as most of these DLL's are standard and not alone that they are dynamic, the very reason why only certain functions that your code uses are loaded, not the entire dll.

Hope this helps, Best regards, Tom.

tommieb75
+1  A: 

Don't worry about this so much, when you "load" a DLL, it's really just a mapped memory file; the Windows OS uses the page fault mechanism to bring in pages on-demand; so if you only use a small piece of the DLL you aren't actually going to fault the whole thing in.

Paul Betts