name conflict multiple libs

Here is the Question /*A.c*/ #include <stdio.h> int sayHi() { printf("Hi, this is AAAAA\n"); return 0; } int sayOut() { sayHi(); printf("Use this to introduce AAAAA\n"); return 0; } /*B.c*/ #include <stdio.h> int sayHi() { printf("Hi, this is BBBBB\n"); return 0; } int sayOut() { sayHi(); printf("Use this to introduce BBBBB\n"); return 0; } #include <stdio.h> extern int sayOut(); int main() { sayOut(); return 0; } # if link A first >gcc test.c -L. -lA -lB >./a.out Hi, this is AAAAA Use this to introduce AAAAA # if link B first >gcc test.c -L. -lB -lA >./a.out Hi, this is BBBBB Use this to introduce BBBBB First solution at first i use dlopen to explicitly load a dynamic library ...

July 6, 2023 · 3 min · hengist

Link Load Lib

Chap I Chap II Preprocessing gcc -E src.c -o src.i This operation did several things. processing all the instructions begin with ‘#’, delete all of them except ‘#pragma’, and process the ‘#include’ recursively. delete all comments. add line number and file name identifiers Compile to assembly code gcc -S src.i -o src.s # or gcc -S src.c -o src.s # or ccl src.c Assembly to machine code as src.s -o src.o # or gcc -c src.s -o src.o # or gcc -c src.c -o src.o Link to executable program ...

July 2, 2023 · 1 min · hengist