On Thu, 12 Nov 2020 at 00:19, Budi via Gcc-help <gcc-help@xxxxxxxxxxx> wrote: > > How do we build/make one dynamic link .so file from many C source TUs > (translation units) as > gcc -o foo.so -shared -fPIC foo.c > > of a single .c file ? gcc -o foo.so -shared -fPIC foo.c bar.c baz.c Or compile each TU to an object file separately and link the objects: gcc -c -fPIC foo.c gcc -c -fPIC bar.c gcc -c -fPIC baz.c gcc -o foo.so -shared -fPIC foo.o bar.o baz.o