[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]
Re: shared library problem
I tried this on Solaris cc. The option for the same is -h name. the help for this says somethings like
Assigns a name to a shared dynamic library; allows you
to keep different versions of a library.
In general, the name after -h should be the same as the
file name given in the -o option. The space between -h
and name is optional.
The linker assigns the specified name to the library
and records the name in the library file as the intrin-
sic name of the library. If there is no -h name option,
then no intrinsic name is recorded in the library file.
When the runtime linker loads the library into an exe-
cutable file, it copies the intrinsic name from the
library file into the executable, into a list of needed
shared library files. Every executable has such a list.
If there is no intrinsic name of a shared library, then
the linker copies the path of the shared library file
What I found was that while compiling It requires the file name to be libmy.so if I give
-l option. The name specified by -h option comes into picture only while executing the
file and not during compilation or linking. This still doesnot solve our original problem
and do U know any utility of this feature?
Shridhar Daithankar wrote:
> Have you used -soname flag. I sets an internal field of library which is
> i.e. if you have a file myfile.so with internal field set to mylib, then -lmylib
> will pick up myfile.so even if there is no file mylib.so.
> This is a recommended method rather than relying on file name.
> man ld for more details...
> "Vani R." wrote:
> > Hi sumit,
> > That's fine. It works for me also. but what i want is using -L and -l options.
> > I am giving the library path where the .so file is existing and -l option to
> > specify the library name ( mylib.so ) . But when i use these options , i am
> > getting error as "mylib.so - no such file or directory" . What should i do ??