Re: Building extensions on Windows using VS2008

From: Magnus Hagander <magnus(at)hagander(dot)net>
To: Craig Ringer <craig(at)postnewspapers(dot)com(dot)au>
Cc: deepak <deepak(dot)pn(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: Building extensions on Windows using VS2008
Date: 2011-02-20 10:51:57
Message-ID: AANLkTikfe16XAi4kZAaxHo4yFr2hR-t9mrsiDtBWaVCM@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sun, Feb 20, 2011 at 05:39, Craig Ringer <craig(at)postnewspapers(dot)com(dot)au> wrote:
> On 02/20/2011 09:38 AM, deepak wrote:
>>
>>
>>    build.pl <http://build.pl> parses the Makefile to determine the list
>>    of sources, etc. Essentially, your extension is built using the unix
>>    Makefile.  Since you've already built Pg its self from sources you
>>    will have used build.pl <http://build.pl> to do it (right?) and
>>    it'll be easy for you to add the contrib module and re-run.
>>
>>    The downside of this approach is that build.pl <http://build.pl>
>>    isn't a complete Makefile parser, and is easily confused by anything
>>    but the most trivial Makefile syntax. I had problems when I was
>>    putting the crashdump module together because build.pl
>>    <http://build.pl> didn't understand ifndef .
>>
>>    --
>>    Craig Ringer
>>
>>
>> Ok, I hadn't realized that the VS build system extrapolates information
>> from unix Makefiles..
>>
>> I briefly tried adding a new contrib module for my extension and
>> re-running the VS build (src\tools\msvc\build.bat), and still get the
>> same error.
>> (about redefinition of errcode).  Somehow, it seems to me that there's
>> an inherent incompatibility..
>
> OK, so you're building it within the main Pg build system. Pg was
> successfully compiled, including files that use elog.h . Yet your extension
> doesn't compile, complaining about a macro/typedef conflict.
>
> This makes me wonder: what's different?

First check would be that you are including postgres.h *at the top* of
your files. It will bring in some defines that affects the windows
header files.

It does (through c.h) have specific handling of errcode on MSVC, for
example.... See around line 60.

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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Reuven M. Lerner 2011-02-20 11:31:09 Questions about octal vs. hex for bytea
Previous Message 页公倒龙 2011-02-20 06:13:51 回复: [GENERAL] How to make the user-defined function or type beingaccessed in the global database server?