Re: Help with User-defined function in PostgreSQL with Visual C++ - Mailing list pgsql-hackers

From Magnus Hagander
Subject Re: Help with User-defined function in PostgreSQL with Visual C++
Date
Msg-id AANLkTi=nbZpKxGKBhd4CfzZ=+6W9ag97Wfm1u5k4a9-h@mail.gmail.com
Whole thread Raw
In response to Re: Help with User-defined function in PostgreSQL with Visual C++  (Itagaki Takahiro <itagaki.takahiro@gmail.com>)
Responses Re: Help with User-defined function in PostgreSQL with Visual C++
Re: Help with User-defined function in PostgreSQL with Visual C++
List pgsql-hackers
On Tue, Sep 28, 2010 at 09:26, Itagaki Takahiro
<itagaki.takahiro@gmail.com> wrote:
> On Tue, Sep 28, 2010 at 3:53 PM, Tom Lane <tgl@sss.pgh.pa.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/


pgsql-hackers by date:

Previous
From: Craig Ringer
Date:
Subject: Re: Help with User-defined function in PostgreSQL with Visual C++
Next
From: Itagaki Takahiro
Date:
Subject: Re: Proposal: plpgsql - "for in array" statement