Why does the C ++ Boost distribution have the `.dll` and `.lib` files?

Howdy. I am currently creating a “shared” library (such as a Windows DLL), which in turn will rely on the Boost C ++ libraries for date time functions. I noticed that my Boost installation (done through Boostpro) has some DLL and LIB files in the accelerated installation lib directory. Ok, I thought it was necessary, so I added them depending on the library in my IDE.

Now I am writing code that uses the date formatting time library, creates a shared library and uses it from a standalone executable. It works, although I just copied the shared library that I created into the executable folder, not the boost_date_time-vc100-mt-1_47.dll . It’s strange. Now I remove Boost’s DLL / library dependency from my project and collect the shared library. It still works.

I'm a little confused. If Boost libraries are really just headers, why does my Boostpro installation have * .lib and * .dll files for datetime and other parts of acceleration? Is there any scenario that I would like to use, given that these accelerator libraries are still compiled into my shared library?

Hope I was clear enough, please let me know if further clarification is needed. Besides FWIW, I use Eclipse CDT + MingW for all this.

+6
source share
1 answer

Most parts of Boost are header-only, while some other parts (at least the file system and iostreams IIRC) require library linking. Therefore, it all depends on which parts of Boost you use. Which parts require linking is documented on the Boost Library Documentation page.

Some libraries use automatic linking. This means that the header files contain compiler-specific code for embedding instructions for referencing the correct libraries in object files. This is a useful feature that should be supported by the compiler. However, gcc toolchains (including MingW) does not support this.

+4
source

Source: https://habr.com/ru/post/923201/


All Articles