Static library & Dynamic library : Confusion

前端 未结 3 2081
栀梦
栀梦 2020-12-29 15:36

I need little clarification in this area. I feel that the terms Static library & Dynamic Library are not correct.

  • lib1.o + lib2.o
3条回答
  •  失恋的感觉
    2020-12-29 16:04

    Let's say I have my App that links with StaticLib.lib, then all the code from both my App and StaticLib.lib will be in the same executable. This means that StaticLib.h contains functions implementation in it.

    Now if I link App with DynamicLib.lib, then my App will use functions implemented in DynamicLib.dll that means that DynamicLib.lib constains references, something like:

    • OpenWAV is found at offset 1 in DynamicLib.dll
    • CloseWAV is found at offset 2 in DynamicLib.dll etc

    The name dynamic means that it can be loaded by any App, not really by linking with DynamicLib.lib, but calling LoadLibrary () and importing the functions exported by the DLL by hand.

    About Relocatable, well at this moment I'm not familiar with the word.

    I'm talking as a Windows programmer so I don't what really is going on on Linux, but judging from the name SO(Shared Objects) are same thing like DLLs.

    Hope my answer was helpful!

提交回复
热议问题