Exampe to include library in a windows app using MS command line compiler.
The other command line parms just tell the compiler that we're
creating a Windows GUI app as opposed to a console app
cl /DWIN32 myapp.c advapi32.lib /link /subsystem:windows
Two different approaches for loading a DLL
First approach
DLL using the import library (mydll.lib) that was created while
compiling the DLL. All you have to do is include the header file
from the creation of the dll in your app and include the import
lib when you're linking your code as illustrated below
cl mydllapp.c mydll.lib
Second approach
Loading DLL on the fly.
cl mydllapp.c
Code:
int main(void)
{
HINSTANCE hmyDLLlib=LoadLibrary("myDLL.DLL");
if(hmyDLLlib==NULL)
printf("Unable to load library!\n");
return 0;
}