Is the standard C library a static library or a dynamic library?

Is the standard C library function (ex.prinf, scanf) processed as a static library function or a dynamic library?

+4
source share
2 answers

it depends on how you link your program. You can go both ways. On VS, you can specify either /MT (static) or /MD (dynamic). In gcc, you can specify the -static-libgcc flag to link your program with a static library.

See http://gcc.gnu.org/onlinedocs/gcc/Link-Options.html for more information on the gcc flags and http://msdn.microsoft.com/en-us/library/abx4dbyh(v=vs .80) .aspx for VS.

+4
source

You do not have to worry.

And the compiler can even process some standard function on purpose if it does it in accordance with what the standard defines.

Sometimes GCC does such things, for example, it can optimize the memset call in a loop ...

If you asked how you linked your foo program, the ldd foo command answers in GNU / Linux.

Greetings.

0
source

All Articles