Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 195
  • Last Modified:

Dynamic Link Libraries

Hi,
Could somebody pls tell me how to build a .so file in UNIX ?.
0
lvenkat
Asked:
lvenkat
1 Solution
 
mlevCommented:
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
 
Rajkumar_RCommented:
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
 
braveheartCommented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now