C - dynamic linked vs. static linked: Unterschied zwischen den Versionen
Zur Navigation springen
Zur Suche springen
| Zeile 8: | Zeile 8: | ||
} | } | ||
</pre> | </pre> | ||
| − | =Dynamisches Kompilieren | + | =Dynamisches Kompilieren= |
*gcc hello.c -o hello.dynamic | *gcc hello.c -o hello.dynamic | ||
*./hello.dynamic | *./hello.dynamic | ||
| Zeile 18: | Zeile 18: | ||
/lib64/ld-linux-x86-64.so.2 (0x00007fc8da489000) | /lib64/ld-linux-x86-64.so.2 (0x00007fc8da489000) | ||
</pre> | </pre> | ||
| + | =Dynamisches Kompilieren und linken= | ||
| + | *gcc -Os -static hello.c -o hello.static | ||
| + | *./hello.static | ||
| + | Hallo Welt! | ||
Version vom 18. September 2022, 16:40 Uhr
Hello World Code in C
#include <stdio.h>
int main(void)
{
puts("Hallo Welt!");
}
Dynamisches Kompilieren
- gcc hello.c -o hello.dynamic
- ./hello.dynamic
Hallo Welt!
- ldd hello.dynamic
linux-vdso.so.1 (0x00007ffdebfc2000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fc8da2a8000) /lib64/ld-linux-x86-64.so.2 (0x00007fc8da489000)
Dynamisches Kompilieren und linken
- gcc -Os -static hello.c -o hello.static
- ./hello.static
Hallo Welt!