Hi, What is better for smaller code and memory usage: static linking or LoadLibrary,GetProcAddress and call eax? Does the function from DLL was included in my exe file if I use a static linking? Thanks
Correct me if I'm wrong but as "DLL" stands for Dynamic Link Library, I don't think dlls can be linked staticly. DLLs contain the actual code for the functions, when a dll is linked dynamically with a lib (i.e. a library created for the dll), only substitutions for the actual functions are placed inside your program. For example, when you use the function MessageBox from user32.dll, a small piece of code in user32.lib is paced in your program, usually a single jump to the function. This piece of code is called in your program whenever it wants to call the messagebox function. So it's not the actual functions that are included, only a piece of code that calls them, you will always need the dll. Another method of using DLLs is loadlibrary/getprocaddress. But this just creates a lot of overhead. As for each function you use, you have to call getprocaddress first. That's not efficient and spaceconsuming. It can be useful though in some cases. Then there are static libraries, like m32lib inside the masm32 package. These libraries contain the actual code, and this code is included in your program, so you don't need any external files after assembling. I hope this will make some things clear, Thomas
Thank you so much for your help! I red MSDN linking DLLs explicitly&implicitly and now all is clear for me. Thanks Tomas!