Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>To reuse a function declared in a DLL you have 2 choices:</p> <p>The first one (and preferable) is to include the corresponding header file declaring the function you want to use, and then linking to the corresponding .lib. This second step appears to be linking statically to the function, but in reality ends up being a stub call that will load the DLL to memory when the first function included in the corresponding DLL is called. For example, to use the <a href="http://msdn.microsoft.com/en-us/library/ms632680(VS.85).aspx" rel="nofollow noreferrer">CreateWindowEx</a> function you include the "WinUser.h" header and link to the "User32.lib" library.</p> <p>The second option is to load the library manually. For this you would call the <a href="http://msdn.microsoft.com/en-us/library/ms684175(VS.85).aspx" rel="nofollow noreferrer">LoadLibrary</a> function to get a handle to the DLL exporing the function you want, and then use <a href="http://msdn.microsoft.com/en-us/library/ms683212(VS.85).aspx" rel="nofollow noreferrer">GetProcAddress</a> to get a pointer to the function. The returned pointer needs to be cast to the appropriate type, and then you then you can use it as any regular function pointer. This option is only recommended if you do not have access to the implementer's header and library, because there is a risk of using incorrect parameters or a mismatched calling convention in your function declaration.</p> <p>PS - I'm simplifying a bit, but this is the core of how the process works.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload