Re: Proposal:Use PGDLLEXPORT for libpq

From: Craig Ringer <craig(at)2ndquadrant(dot)com>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: Yury Zhuravlev <u(dot)zhuravlev(at)postgrespro(dot)ru>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: Proposal:Use PGDLLEXPORT for libpq
Date: 2016-01-27 13:05:06
Message-ID: CAMsr+YFEpcbLT4VxW23Qs9nf7k1c6VU3R5C_w1emtXq=h2ZR=w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 27 January 2016 at 20:54, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
wrote:

> > If so many problems with MSVC can discard his support of Postgres?
>

I strongly disagree. MSVC is a high quality compiler and the primary tool
for the platform. Yes, it's behind on standards support and that's annoying
- OTOH MinGW relies on reverse-engineered headers, an old gcc fork, and
has had some pretty nasty bugs.

It's a bit like saying we should drop gcc support on Linux and use icc or
clang because it's more convenient for us.

Every platform has warts. We're just more used to ignoring warts on
!windows.

> That doesn't sound likely. Keep in mind that users might want to
> compile extension modules, and not everyone is going to use mingw for
> that. As far as I know, stuff compiled with MSVC is not compatible with
> mingw compiled objects. So even if the main packages switched to
> compiling with mingw, we'd probably still want to support MSVC.
>
>
They are compatible. You can use mingw modules in a MSVC-built postgres.
The other way around should work too.

The main reason why is that on Windows you are expected to be very careful
about your C library, always free()ing memory in the same module (DLL/EXE)
you malloc() it in. Same rules with file handles, etc. This is required to
work correctly with modules compiled with a mix of MSVC versions or mix of
debug and release MSVC runtimes. The same principle applies to MinGW.

> > Under windows we can use MinGW64/Msys or LLVM/Clang for MSVC.
>
> I'm guessing that LLVM/Clang port would be useful for something, but I'm
> not clear what.
>
> Are we moving forward with the CMake stuff? It would be *awesome* to
> get rid of the MSVC build scripts, and perhaps we can move forward on
> some smaller items such as PGDLLEXPORT markings as well.
>
>
Yeah, strongly agree there.

CMake has excellent MSVC support btw.

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2016-01-27 13:11:05 Re: Proposal:Use PGDLLEXPORT for libpq
Previous Message Alvaro Herrera 2016-01-27 12:54:21 Re: Proposal:Use PGDLLEXPORT for libpq