When I compile a C app with Dev-c++/gcc it dynamically links with msvcrt.dll. Is there is a way to link with a static c library?
Printable View
When I compile a C app with Dev-c++/gcc it dynamically links with msvcrt.dll. Is there is a way to link with a static c library?
If you want to compile in a static way you have to use --static
Maybe you are trying to avoid that kind of automatic linking between your program and the standar libraries, if you want to do that yo have to:
"gcc --ffreestanding file.c"
The --static and --freestanding options doesn't seem to be helping because the program still links with msvcrt.dll.
I do not program under a Windows environment but I have some expirience using gcc under DOS and NIX*
The next piece of text is from the GCC Manual:
Assert that compilation takes place in a freestanding environment. This implies -fno-builtin. A freestanding environment is one in which the standard library may not exist, and program startup may not necessarily be at "main". The most obvious example is an OS kernel.
So, you don't want to link againts that library, do you ? Why don't you explain me what are you wanna do ?
What i wanted to do was to statically link to the c standard library instead of msvcrt.dll.
Ok, but What Happend when you use --freestanding ?
Do you get some error ?
No I didn't get an error but it didn't change anything. The program still linked with msvcrt.dll.