Re: Help with User-defined function in PostgreSQL with Visual C++

From: Magnus Hagander <magnus(at)hagander(dot)net>
To: Itagaki Takahiro <itagaki(dot)takahiro(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Robert Haas <robertmhaas(at)gmail(dot)com>, Euler Taveira de Oliveira <euler(at)timbira(dot)com>, Esteban Zimanyi <estebanzimanyi(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Help with User-defined function in PostgreSQL with Visual C++
Date: 2010-09-28 09:16:38
Message-ID: AANLkTi=nbZpKxGKBhd4CfzZ=+6W9ag97Wfm1u5k4a9-h@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Sep 28, 2010 at 09:26, Itagaki Takahiro
<itagaki(dot)takahiro(at)gmail(dot)com> wrote:
> On Tue, Sep 28, 2010 at 3:53 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>>> As I mentioned, we don't need the marks in our build environment at all.
>>
>> In that case, anybody who does need it should fix their build
>> environment.
>>
>> I grow really weary of the idea that we should submit to arbitrary
>> amounts of uglification of our source code so that it will deal with
>> this week's Windows oddness.  The Windows folk need to be willing to
>> do a bit of work on their end.
>
> Windows has 3 levels of function visibilities in a DLL:
>  1. exported from the DLL
>  2. module global, but not exported
>  3. static (private in file), of course not exported
>
> On UNIXes, 2 is always 1. So we don't have to distinguish between
> global and exported functions. But standard DLL projects on Windows
> require marking which functions should be exported.
>
> I'm not sure why we can build modules without any EXPORT marks,
> though we can do it actually... It is very unnatural on Windows.
>
>
> If we want to avoid adding PGDLLEXPORTs, we could have "sample MSVC
> project with proper settings" in tutorial or documentation instead.
> It should be opened with VC++ GUI (not from command line!) and can
> be generate DLLs in the same way we're using to build the core.

We're talking about the "export all symbols" thing, right? I *don't*
think we want to recommend people to do that - it creates bloated DLL
files, for no really good reason. Also, it's not just a matter of a
msvc project - we do that with a perl hack
(http://git.postgresql.org/gitweb?p=postgresql.git;a=blob;f=src/tools/msvc/gendef.pl;h=b8538dd79b8baf21ede87b2ec1aba0276fd3b3d9;hb=62b6aaa40b2abb26edf18d1cd00dffcac090f67a)
It's not a good way.

We might, however, want to add a specific section to the
*documentation* about building extensions on Windows. We have section
35.9.6 which lists a bunch of OSes, where windows is clearly missing.
But perhaps a complete section of it's own, like the one for pgxs in
35.9.6, would be even better?

--
 Magnus Hagander
 Me: http://www.hagander.net/
 Work: http://www.redpill-linpro.com/

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Itagaki Takahiro 2010-09-28 09:25:37 Re: Proposal: plpgsql - "for in array" statement
Previous Message Craig Ringer 2010-09-28 08:51:12 Re: Help with User-defined function in PostgreSQL with Visual C++