[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Dynamic Link Libraries

Posted on 1998-07-17
3
Medium Priority
?
187 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 400 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

Tech or Treat!

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

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

Let's say you need to move the data of a file system from one partition to another. This generally involves dismounting the file system, backing it up to tapes, and restoring it to a new partition. You may also copy the file system from one place to…
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…
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.:
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Suggested Courses

656 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