Solved

Dynamic Link Libraries

Posted on 1998-07-17
3
182 Views
Last Modified: 2010-04-21
Hi,
Could somebody pls tell me how to build a .so file in UNIX ?.
0
Comment
Question by:lvenkat
3 Comments
 
LVL 2

Expert Comment

by:mlev
ID: 2008887
Which UNIX? It's different on nearly all of them.
There's a GNU tool called "libtool" that tries to standardise
that process (it knows how to build shared libraries for
various platforms); you might want to use it if you need
to create a portable package. Otherwise, if you only need
it for a specific platform, tell me which one and I'll tell you
the necessary compiler/linker flags.
0
 
LVL 1

Accepted Solution

by:
Rajkumar_R earned 200 total points
ID: 2008888
Say you have two files file1.cpp and file2.cpp out of which you have to make a so file with the name myso.so.

step:1

Build all the .cpp or .c etc files with -kpic option. (just make the .o files)

$ CC -Kpic -c file1.cpp file2.cpp

step:2

Make the .so as follows

$CC -G -o myso.so  file1.o  file2.o

you will get the shared object: myso.so



0
 
LVL 3

Expert Comment

by:braveheart
ID: 2008889
It *is* slightly different on all flavours of UNIX but the only difference is the option on the linker command. To determine which option you should use on each platform you will have to RTFM.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When you do backups in the Solaris Operating System, the file system must be inactive. Otherwise, the output may be inconsistent. A file system is inactive when it's unmounted or it's write-locked by the operating system. Although the fssnap utility…
Every server (virtual or physical) needs a console: and the console can be provided through hardware directly connected, software for remote connections, local connections, through a KVM, etc. This document explains the different types of consol…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

25 Experts available now in Live!

Get 1:1 Help Now