Linux : Creating a shared library

[root@sam c_src]# gcc -fPIC -c example_lib.c
[root@sam c_src]# gcc -shared -o example_lib.so example_lib.o

If there are more .o files need to be in .so file

[root@sam c_src]# gcc -shared -o example_lib.so example_lib.o example_lib1.o
Advertisements
Tagged

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: