Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Whether C standard library is static library or dynamic library? [closed]

Tags:

c

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

like image 365
user966379 Avatar asked Oct 28 '11 08:10

user966379


People also ask

Is C standard library static or dynamic?

It's specific to the version of the compiler used. This library is always statically linked, even when using a dynamically linked UCRT.

How do I know if my library is static or dynamic?

What are the differences between static and dynamic libraries? Static libraries, while reusable in multiple programs, are locked into a program at compile time. Dynamic, or shared libraries, on the other hand, exist as separate files outside of the executable file.

What is static library and dynamic library in C?

A static library must be linked into the final executable; it becomes part of the executable and follows it wherever it goes. A dynamic library is loaded every time the executable is executed and remains separate from the executable as a DLL file.

What happened if standard library is not present in C?

But in pure C, with no extensions, and the standard library functions removed, you basically can't do anything other than read the command line arguments, do some work, and return a status code from main .


1 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). On gcc, you can specify -static-libgcc flag to link your program against the static library.

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

like image 103
JosephH Avatar answered Nov 14 '22 02:11

JosephH