This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Criteria for GCC 4.0 [auto-locating libraries]
- From: Per Bothner <per at bothner dot com>
- To: Theodore Papadopoulo <Theodore dot Papadopoulo at sophia dot inria dot fr>
- Cc: Steven Bosscher <stevenb at suse dot de>, Richard Kenner <kenner at vlsi1 dot ultra dot nyu dot edu>, gcc at gcc dot gnu dot org
- Date: Tue, 01 Jun 2004 23:50:40 -0700
- Subject: Re: Criteria for GCC 4.0 [auto-locating libraries]
- References: <200406011309.i51D9ncu005750@mururoa.inria.fr>
Theodore Papadopoulo wrote:
I really think that the best way to do this is for the compiler to
produce .o files that somehow contain the gcc library requirements.
Then any gcc driver used to link the files together should collect
these libraries and add them to the linker command line.
...
Remember that this is only for gcc's internal libraries,
Actually, I think it should be supported for user libraries too.
Remember that bad old days when you had to specify -lm if you
used a math function? Well, we still have the same problem,
but worse. For C, C++, and Java libraries (which are already in a
global namespace), prorammers are requires to know the magic -l
incantation to add. This is ridiculous.
For Java, if class A references class B, the compiler needs to be
able to find class B when compling class A. So the compiler needs
to remember the library where it found B, and include that information
in A.o.
For C and C++, a header file foo.h could include a __Pragma that
would enable the linker to find the library containing foo.o.
I'm talking about defaults - if should be possible to specify to
linker that it should use some other library that it was compiled
against - but most users should not need to add -l or -L flags.
--
--Per Bothner
per@bothner.com http://per.bothner.com/