Re: narwhal and PGDLLIMPORT

From: Andres Freund <andres(at)2ndquadrant(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
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 13:12:09
Message-ID: 20140215131209.GG20973@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2014-02-12 14:11:10 -0500, Tom Lane wrote:
> Marco Atzeri <marco(dot)atzeri(at)gmail(dot)com> writes:
> > On 12/02/2014 19:19, Andres Freund wrote:
> >> On 2014-02-12 19:13:07 +0100, Marco Atzeri wrote:
> >>> About PGDLLIMPORT , my build log is full of "warning: ‘optarg’ redeclared
> >>> without dllimport attribute: previous dllimport ignored "
>
> >> That should be fixed then. I guess cygwin's getopt.h declares it that way?
>
> > from /usr/include/getopt.h
>
> > extern char __declspec(dllimport) *optarg; /* argument associated
> > with option */
>
> Hm. All of our files that use getopt also do
>
> extern char *optarg;
> extern int optind,
> opterr;
>
> #ifdef HAVE_INT_OPTRESET
> extern int optreset; /* might not be declared by system headers */
> #endif

At least zic.c doesn't...

So, now that brolga is revived, this unsurprisingly causes breakage
there after the --disable-auto-export change. ISTM the easiest way to
deal with this is to just adorn all those with a PGDLLIMPORT?

I don't immediately see how the HAVE_INT_OPTRESET stuff could be reused
in any interesting way as it's really independent of optind/optarg
whether it exists?

It strikes me that we should just move all that to
src/include/getopt_long.h and include that from the places that
currently include getopt.h directly. It's pretty pointless to have all
those externs, HAVE_GETOPT_H, HAVE_INT_OPTRESET in every file. It'd be
prettier if it were named getopt.h, but well...

Greetings,

Andres Freund

--
Andres Freund http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2014-02-15 13:34:19 commit fest 2014-01 week 4 report
Previous Message Andres Freund 2014-02-15 11:45:30 Re: Recovery inconsistencies, standby much larger than primary