Solved

Dynamic Link Libraries

Posted on 1998-07-17
3
177 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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

I have been running these systems for a few years now and I am just very happy with them.   I just wanted to share the manual that I have created for upgrades and other things.  Oooh yes! FreeBSD makes me happy (as a server), no maintenance and I al…
Java performance on Solaris - Managing CPUs There are various resource controls in operating system which directly/indirectly influence the performance of application. one of the most important resource controls is "CPU".   In a multithreaded…
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…
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.

708 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

16 Experts available now in Live!

Get 1:1 Help Now