Re: Future of src/utils

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Future of src/utils
Date: 2002-07-17 02:47:36
Message-ID: 200207170247.g6H2laZ15153@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tom Lane wrote:
> Peter Eisentraut <peter_e(at)gmx(dot)net> writes:
> > I don't think we need to move the subdirectories, which involve stuff
> > that's heavily tied to the backend. But the generic C library replacement
> > files should move into src/utils preferably. In fact, what we could do is
> > assemble all the files we need (as determined by configure) into a static
> > library and link all executables with that. That way we don't have to
> > deal with the individual files in each individual makefile.
>
> I like that a lot. But will it work for libpq? I have a feeling we'd

Yes, I like it too, and I like the fact that the subdirectories stay,
because those are so backend-specific, it doesn't make any sense to move
them.

Can we move them to src/port rather than src/utils? Port makes more
sense to me because that's what they are. Maybe is should be called
src/libc?

> end up linking *all* the replacement functions into libpq, which might
> create some namespace issues for client applications. Ideally we should
> only link the functions libpq actually needs into libpq, but I'm not
> sure that works with standard linker behavior.

Linkers work per object file, so if each member of the library has only
one function in it (which is how we do it now anyway) a linker will pick
out only the object files it needs. Many C libraries have multiple
functions per object file, and that's where you see the namespace
pollution.

Actually, our current setup is more prone to pollution becuse we
unconditionally add *.o files to the link line. Add a library makes
sure only the object files needed are added to the executable.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2002-07-17 02:54:28 Re: getopt_long search in configure
Previous Message Christopher Kings-Lynne 2002-07-17 02:07:44 Re: pg_views.definition