Re: narwhal and PGDLLIMPORT - Mailing list pgsql-hackers

From Craig Ringer
Subject Re: narwhal and PGDLLIMPORT
Date
Msg-id 5300C632.90101@2ndquadrant.com
Whole thread Raw
In response to Re: narwhal and PGDLLIMPORT  (Andres Freund <andres@2ndquadrant.com>)
List pgsql-hackers
On 02/16/2014 07:03 AM, Andres Freund wrote:
> On 2014-02-15 17:48:00 -0500, Tom Lane wrote:
>> Marco Atzeri <marco.atzeri@gmail.com> writes:
>>>   32 $ grep -rH in6addr_any *
>>> cygwin/in6.h:extern const struct in6_addr in6addr_any;
>>> cygwin/version.h:          in6addr_any, in6addr_loopback.
>>
>> So how come there's a declspec on the getopt.h variables, but not this
>> one?
> 
> Well, those are real constants, so they probably are fully contained in
> the static link library, no need to dynamically resolve them.

If they're externs that're then defined in a single module, that's not
the case.

Only if they're *not* declared extern, and thus added to each
compilation unit then de-duplicated during linking, may they be safely
referred to without a __declspec(dllimport) because each module gets its
own copy.

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



pgsql-hackers by date:

Previous
From: Craig Ringer
Date:
Subject: Re: Long paths for tablespace leads to uninterruptible hang in Windows
Next
From: Emre Hasegeli
Date:
Subject: Re: GiST support for inet datatypes