Further patch for VS2005

Started by Magnus Haganderabout 20 years ago4 messagespatches
Jump to latest
#1Magnus Hagander
magnus@hagander.net

Hi!

Attached patch is required ot build with the CRT that comes with Visual
Studio 2005. Basically MS defined errcode in the headers with a typedef,
so we have to #define it out of the way.

While at it, fix a function declaration in plpython that didn't match
the implementation (volatile missing).

//Magnus

Attachments:

vc.patchapplication/octet-stream; name=vc.patchDownload+8-2
#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Magnus Hagander (#1)
Re: Further patch for VS2005

"Magnus Hagander" <mha@sollentuna.net> writes:

*** src/pl/plpython/plpython.c	25 Jun 2006 00:18:24 -0000	1.83
--- src/pl/plpython/plpython.c	26 Jun 2006 13:58:56 -0000
***************
*** 10,16 ****
--- 10,19 ----
/* Python uses #pragma to bring in a non-default libpython on VC++ if
* _DEBUG is defined */
#undef _DEBUG
+ /* Also hide away errcode, since we load Python.h before postgres.h */
+ #define errcode __vc_errcode
#include <Python.h>
+ #undef errcode
#define _DEBUG
#else
#include <Python.h>

BTW, it strikes me as a fairly bad idea to be including <Python.h>
first; that goes directly against the conventions we established to be
sure that largefile support doesn't break. Has anyone looked into
making plpython.c conform to project standards by including postgres.h
first?

regards, tom lane

#3Magnus Hagander
magnus@hagander.net
In reply to: Tom Lane (#2)
Re: Further patch for VS2005

*** src/pl/plpython/plpython.c 25 Jun 2006 00:18:24

-0000 1.83

--- src/pl/plpython/plpython.c	26 Jun 2006 13:58:56 -0000
***************
*** 10,16 ****
--- 10,19 ----
/* Python uses #pragma to bring in a non-default 

libpython on VC++ if

* _DEBUG is defined */
#undef _DEBUG
+ /* Also hide away errcode, since we load Python.h before

postgres.h

+ */ #define errcode __vc_errcode
#include <Python.h>
+ #undef errcode
#define _DEBUG
#else
#include <Python.h>

BTW, it strikes me as a fairly bad idea to be including
<Python.h> first; that goes directly against the conventions
we established to be sure that largefile support doesn't
break. Has anyone looked into making plpython.c conform to
project standards by including postgres.h first?

Not me. Last time I did something like that it came back and bit me
because apparantly python does things significantly different on
different platforms. Now that we have the buildfarm it might be worth a
try. I don't have a *nix box around with python ATM, but if nobody beats
me to it I can try it later...

//Magnus

#4Bruce Momjian
bruce@momjian.us
In reply to: Magnus Hagander (#1)
Re: Further patch for VS2005

Patch applied. Thanks.

---------------------------------------------------------------------------

Magnus Hagander wrote:

Hi!

Attached patch is required ot build with the CRT that comes with Visual
Studio 2005. Basically MS defined errcode in the headers with a typedef,
so we have to #define it out of the way.

While at it, fix a function declaration in plpython that didn't match
the implementation (volatile missing).

//Magnus

Content-Description: vc.patch

[ Attachment, skipping... ]

---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly

--
Bruce Momjian bruce@momjian.us
EnterpriseDB http://www.enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +