Re: narwhal and PGDLLIMPORT

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andres Freund <andres(at)2ndquadrant(dot)com>
Cc: Marco Atzeri <marco(dot)atzeri(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: narwhal and PGDLLIMPORT
Date: 2014-02-15 17:16:58
Message-ID: 24683.1392484618@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Andres Freund <andres(at)2ndquadrant(dot)com> writes:
> On 2014-02-15 10:59:17 -0500, Tom Lane wrote:
>> I don't have time right now to research it (have to go shovel snow),
>> but I think that at least some of the issue was that we needed the
>> externs when we force use of our src/port implementation.

> I think that'd be solvable easy enough if we'd just always included pg's
> getopt_long.h (or a new getopt.h) which properly deals with defining
> them when included. That'd centralize all the magic and it'd overall get
> rid of a ton of ifdefs and externs.

Yeah, there are enough copies of that stuff that centralizing them
sounds like a great idea. Call it "pg_getopt.h", perhaps?

AFAICS, getopt_long.h just defines them unconditionally, which is
as wrong as everyplace else. The reasonable alternatives seem to be

(1) invent pg_getopt.h, which would #include <getopt.h> if available
and then provide properly-ifdef'd externs for optarg and friends;
getopt_long.h would #include pg_getopt.h.

(2) Just do the above in getopt_long.h, and include it in the places
that currently have externs for optarg and friends.

Option (2) seems a bit odd in files that aren't actually using
getopt_long(), but it avoids making a new header file.

Preferences?

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2014-02-15 17:19:35 Re: Create function prototype as part of PG_FUNCTION_INFO_V1
Previous Message Tomas Vondra 2014-02-15 16:59:24 Re: GIN improvements part2: fast scan