Re: narwhal and PGDLLIMPORT - Mailing list pgsql-hackers

From Amit Kapila
Subject Re: narwhal and PGDLLIMPORT
Date
Msg-id CAA4eK1+0+rz=L_Sbf6mM6ZjTrC2sKu=fs8pGAQD5qkMDKPxkWw@mail.gmail.com
Whole thread Raw
In response to Re: narwhal and PGDLLIMPORT  (Craig Ringer <craig@2ndquadrant.com>)
List pgsql-hackers
On Mon, Feb 3, 2014 at 6:52 AM, Craig Ringer <craig@2ndquadrant.com> wrote:
> On 02/02/2014 09:03 AM, Tom Lane wrote:
>> According to the buildfarm database, narwhal is running a gcc build on
>> Windows 2003.  That hardly seems like a mainstream use case.  I could
>> believe that it might be of interest to developers, but clearly no
>> developers are actually running such a build.
>>
>> I think we should give serious consideration to desupporting this
>> combination
>
> I'm not a fan of MinGW (gcc) on Windows, it's a right pain. It's also
> the only open source compiler currently supported for PostgreSQL on
> Windows - practically the only one available. I don't know about you,
> but I'm not too keen on assuming Microsoft will continue to offer free
> toolchains that're usable for our purposes. They're crippling their free
> build tools more and more with each release, which isn't a good trend.
>
> If you wish to eliminate PGDLLIMPORT from the codebase the correct
> approach would be building with --export-all-symbols (a MinGW extension
> flag to gcc). That would make the MinGW builds consistent with the MSVC
> build, which generates a .def file that exports all symbols.
>
> As for why PGDLLIMPORT appears to be required in some places on the MSVC
> build, so far it's looking like we auto-export functions, but not
> necessarily variables.

I could see both the variables (DateStyle and IntervalStyle) currently Tom
points out in both .def file and by using dumpbin utility.
I think these symbols are exported, the main reason of failure is that they
are not imported in postres_fdw as we have not used PGDLLIMPORT.

Looking at below code, as per my understanding for contrib modules
BUILDING_DLL is not defined and by using PGDLLIMPORT, it
can lead to import of the required variables.

#ifdef BUILDING_DLL
#define PGDLLIMPORT __declspec (dllexport)
#else /* not BUILDING_DLL */
#define PGDLLIMPORT __declspec (dllimport)
#endif


We need this for variables, but they are optional for functions. Please refer
below link:
http://msdn.microsoft.com/en-us/library/8fskxacy(v=vs.80).aspx


With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com



pgsql-hackers by date:

Previous
From: Craig Ringer
Date:
Subject: Re: narwhal and PGDLLIMPORT
Next
From: Amit Kapila
Date:
Subject: Re: narwhal and PGDLLIMPORT