how to build a c file into a shared object (library) in linux -


I need to create a Hello World function in the dynamic library. I'm coding in Linux on C language. Can someone help in such a sample code? And also to link to the generated library?

The first compiled files for the object code

  $ gcc -Wall -fPIC -c test1.c test2.c   

-fPIC means this state will produce an independent code. $ gcc -shared -o libtest.so test1.o test2.o

Comments