Files
ElliotKillick-operating-sys…/lazy-bind/dynamic-link/lib1.c
T
2024-03-19 00:20:55 -04:00

15 lines
442 B
C

#include <stdio.h>
extern void func2();
// Differing external function names matters when dynamic linking due to ELF having a flat symbol namespace
__attribute__((constructor))
void init1() {
puts("Library 1 loaded successfully!\n");
// Call lazily binded export
// Whether lazy binding actually happens depends on your loader
// In GDB, stepping in shows the loader lazily resolving func2 before calling it
func2();
}