问题
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.
回答1:
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
来源:https://stackoverflow.com/questions/24526515/how-to-generate-a-so-file-from-multiple-source-files