Matheen
Matheen

Reputation: 255

How to generate a .so file from multiple source files

I have been trying from the past few days for generating a shared library. I have header files, source files and asm files as well. I have tried to follow quiet a number of similar questions but I was not able to locate one that specifies the steps needed to generate a .so file from multiple source, header and asm files. I have been facing many issues for generating the .so file. If someone could help me with the step by step procedure for generating a .so file, I would be very grateful. Also, a few tips for making the correct make file would be helpful.

Upvotes: 3

Views: 8921

Answers (1)

Saurabh Sengar
Saurabh Sengar

Reputation: 918

Say u have 2 programs foo1.c and foo2.c

Step1: create .o of both

     gcc -Wall -fPIC -c foo1.c

     gcc -Wall -fPIC -c foo2.c

Step2: create .so from above object files

   gcc -shared -o libfoo.so foo1.o foo2.o

Upvotes: 10

Related Questions