When I was going to set up my developing environment for (SDLSimple DirectMediaLayer)
, I downloaded the package provided by the website, from the readme.txt
file I found that I need both .lib
and .dll
...
My question is :
.lib
for windows
is like .a
for linux
, is static library, and .dll
for windows
is like .so
for linux
, is shared library, is this correct ?.lib
or .dll
, since the work they do is the same ? So why bother to get both two in one program ?.dll
, if my memory servers me right, the one of the advantage for shared library
is they can be updated while the program is running, so how can people do this, if we update the .dll
file, how can an running program get to know the changes of the .dll
and reload it to memory ?The only way to access a bare DLL without a . lib file is to load the DLL explicitly with LoadLibrary() , get pointers to the exported functions you want to access with GetProcAddress() , and then cast those pointers to the proper function signature.
LIB (lib.exe) creates standard libraries, import libraries, and export files you can use with LINK when building a program.
There are static libraries (LIB) and dynamic libraries (DLL) - but note that . LIB files can be either static libraries (containing object files) or import libraries (containing symbols to allow the linker to link to a DLL). Libraries are used because you may have code that you want to use in many programs.
Yes, the Core and Utils code will be duplicated. Instead of building them as static libs you can build them as dlls and use anywhere. Save this answer.
In VC, there are two kinds of libs.
First type is a "real library", generated by the "static library project", which contains everything you can link and run, without dll.
The second type is "import library", generated by the "dll project", which just contains the symbols the link.exe needs. You can link to the library, but you need the dll to run.
There are two ways to use a dll. Link to the "import library" or "use LoadLibrary API".
You can not change the dll file when the dll is loaded.
But if you use LoadLibrary to load the dll, you can use FreeLibrary to unload the dll, change the dll and then use LoadLibrary to load the new dll. Of course, you need to monitor something to invoke this procedure.
Still the easier way is that, use a loader to do the update, then load the real exe.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With