Re: Compiling extensions on Windows

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Craig Ringer <craig(at)2ndquadrant(dot)com>
Cc: Sandeep Thakkar <sandeep(dot)thakkar(at)enterprisedb(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>, Dave Page <dpage(at)pgadmin(dot)org>
Subject: Re: Compiling extensions on Windows
Date: 2014-01-12 18:04:30
Message-ID: 7948.1389549870@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Craig Ringer <craig(at)2ndquadrant(dot)com> writes:
> Turned out to be trivial to test. If the prototype with PGDLLEXPORT
> appears *first*, then all is well. If the prototype with PGDLLEXPORT
> appears AFTER a user-provided prototype it fails with:

That's sort of what I thought would happen. It's problematic because
putting the extern before the PG_FUNCTION_INFO_V1 is standard practice,
especially if you have the extern in a header file.

> I think we can just emit a prototype for the function from
> PG_FUNCTION_INFO_V1.

Doesn't sound like it; we'll still be forced to modify or remove
manually-written externs in basically all contrib and third-party code,
if we want it to build on Windows. Which, as I said before, does not
seem to me to be a workable solution path at all. It would take
years to track down all the third-party code and get it fixed, if
the authors don't themselves build/test on Windows.

And I continue to maintain that it's not acceptable for the Windows port
to require this anyway. If any other platform came to us and said "hey
guys, you need to plaster this non-ANSI-C decoration on every exported
function", what response do you think they'd get?

One last point is that "automatically export every external symbol" is
exactly what happens for these modules on Unix-ish platforms. If it
doesn't work the same way on Windows, we're just opening ourselves up to
subtle portability issues.

This needs to be fixed in the Windows build system, not the source code.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavel Stehule 2014-01-12 19:58:52 Re: proposal, patch: allow multiple plpgsql plugins
Previous Message Noah Misch 2014-01-12 17:53:40 Re: Partitioning performance: cache stringToNode() of pg_constraint.ccbin