Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > how to ask gcc to link with older library ?

Reply
Thread Tools

how to ask gcc to link with older library ?

 
 
KC
Guest
Posts: n/a
 
      06-26-2005
Hi,

I have a library with both newer and older version
installed, their soname are libHELLO.so.1 and libHELLO.so.2.

When I use

gcc prog.c -o prog -lHELLO

the prog will use libHELLO.so.2 by default.
A simple question, how can I ask gcc to use
libHELLO.so.1 ?

Thanks

Regards
KC

 
Reply With Quote
 
 
 
 
Walter Roberson
Guest
Posts: n/a
 
      06-26-2005
In article <(E-Mail Removed) .com>,
KC <(E-Mail Removed)> wrote:
>I have a library with both newer and older version
>installed, their soname are libHELLO.so.1 and libHELLO.so.2.


Although the C standards talk about the standard library, the
implementation details are intentially left exceedingly vague --
to the point where the "library" could be an inherent part of
the compiler, or of the OS, or in source code form, rather than a
seperate file.

The C standards do not specify anything (that I can recall) about the
existance of other libraries -- only that there will be the ability to
link together the compilation of seperate files. I haven't reviewed the
wording for awhile, but my recollection is that a compiler that
accepted only source files and insisted that all those source files
be named on the (same) command line would be conforming -- i.e.,
intermediate object code and libraries are not required to exist.


>When I use
>gcc prog.c -o prog -lHELLO
>the prog will use libHELLO.so.2 by default.
>A simple question, how can I ask gcc to use
>libHELLO.so.1 ?


As per the above discussion, that is a system and compiler dependant
matter that you may need to ask about in one of the gnu.* newsgroups.

In many implementations, you can link a specific version of a
library by naming the fuller name of the containing file. For
example,

gcc prog.c -o prog -LHELLO.so.1

or it might in your system be necessary to go as far as something like

gcc -o prog prog.c /usr/local/lib/libHELLO.so.1

If these don't work for you, ask in the gnu groups, specifying there
your operating system.
--
'The short version of what Walter said is "You have asked a question
which has no useful answer, please reconsider the nature of the
problem you wish to solve".' -- Tony Mantler
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
GCC 3.4.3 and GCC 4.1.2 ashnin C++ 1 07-07-2008 01:10 PM
Template construction in old gcc 3.3.3 does not compile in gcc 3.4.4 eknecronzontas@yahoo.com C++ 5 09-17-2005 12:27 AM
gcc 2.95 and gcc 3.2 gouqizi.lvcha@gmail.com C++ 8 03-16-2005 02:34 AM
C99 structure initialization in gcc-2.95.3 vs gcc-3.3.1 Kevin P. Fleming C Programming 2 11-06-2003 05:15 AM



Advertisments