How is the standard C ++ library related to my application?

When I usually use code (including headers) from third-party (non-standard) C ++ libraries, the embedded binary is linked to (or included) the target executable representing my application, but what happens with the C ++ standard library ?, as far as I saw , I do not need to send a library with an application that uses code only from the standard C ++ library, so is this code statically linked and included in the executable?

+5
source share
5 answers

No, default libraries are dynamically linked at runtime by default.

When launched, the dynamic loader will look in several standard places for dynamic libraries if it detects that it is loading and starting, otherwise the application crashes.

On Unix systems:
/ usr / lib: look for: libstdC ++ *

On Windows:
c: \ windows \ system32 look for: MSVCRT.DLL

There are also several environment variables that can affect the search path. Look at the page of your platforms for dlopen to see what they are. All you need should be on the man pages for dlopen on your platform.

Most systems have these libraries in their respective places and will be automatically found.
The rest of the STL will not introduce additional generic lib dependencies.

+11

MinGW gcc/g++ (4.40) dll, , -shared-libstd++.

/mingw/lib/gcc/mingw 32/[gcc version]. - libstd++. A. ++ MinGW.

+6

MinGW ++ MSVCRT.DLL. , - , ODBC, ODBC32.DLL(, , DLL Windows). , std::string std::vector MinGW ++, .

,   "Dependency Walker" http://www.dependencywalker.com/

+3

, . libstdc++.so (iostream, , ).

+1

C ++ , , , .

, . , , , , MSV++, , , , , , , installpack (. ). Solaris ( ). Linux , - GPL, .

+1
source

All Articles