Skip to content

Commit d8f75d4

Browse files
committed
Fix Win32/Cygwin problems:
After updating to the latest cvs, and also building most of the addons (like PLs), the following patch is neededf for win32 + Visual C++. * Switch to use the new win32 semaphore code * Rename win32_open to pgwin32_open. win32_open collides with symbols defined in Perl. MingW didn't detect ig, MSVC did. And it's a bit too generic a name to export globally, imho... * Python defines some partially broken #pragmas in the headers when doing a debug build. Workaround. Magnus Hagander
1 parent ac7a126 commit d8f75d4

File tree

4 files changed

+19
-8
lines changed

4 files changed

+19
-8
lines changed

src/include/pg_config.h.win32

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -628,14 +628,17 @@
628628
/* #undef USE_SSL */
629629

630630
/* Define to select SysV-style semaphores. */
631-
#define USE_SYSV_SEMAPHORES 1
631+
/* #undef USE_SYSV_SEMAPHORES */
632632

633633
/* Define to select SysV-style shared memory. */
634634
#define USE_SYSV_SHARED_MEMORY 1
635635

636636
/* Define to select unnamed POSIX semaphores. */
637637
/* #undef USE_UNNAMED_POSIX_SEMAPHORES */
638638

639+
/* Define to select Win32-style semaphores. */
640+
#define USE_WIN32_SEMAPHORES
641+
639642
/* Number of bits in a file offset, on hosts where this is settable. */
640643
/* #undef _FILE_OFFSET_BITS */
641644

src/include/port.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
77
* Portions Copyright (c) 1994, Regents of the University of California
88
*
9-
* $PostgreSQL: pgsql/src/include/port.h,v 1.92 2006/06/07 22:24:45 momjian Exp $
9+
* $PostgreSQL: pgsql/src/include/port.h,v 1.93 2006/06/25 00:18:24 momjian Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -246,10 +246,10 @@ extern bool rmtree(char *path, bool rmtopdir);
246246

247247
/* open() replacement to allow delete of held files and passing
248248
* of special options. */
249-
extern int win32_open(const char *, int,...);
249+
extern int pgwin32_open(const char *, int,...);
250250

251251
#ifndef FRONTEND
252-
#define open(a,b,c) win32_open(a,b,c)
252+
#define open(a,b,c) pgwin32_open(a,b,c)
253253
#endif
254254

255255
#define popen(a,b) _popen(a,b)

src/pl/plpython/plpython.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,20 @@
11
/**********************************************************************
22
* plpython.c - python as a procedural language for PostgreSQL
33
*
4-
* $PostgreSQL: pgsql/src/pl/plpython/plpython.c,v 1.82 2006/06/16 18:42:23 tgl Exp $
4+
* $PostgreSQL: pgsql/src/pl/plpython/plpython.c,v 1.83 2006/06/25 00:18:24 momjian Exp $
55
*
66
*********************************************************************
77
*/
88

9+
#if defined(_MSC_VER) && defined(_DEBUG)
10+
/* Python uses #pragma to bring in a non-default libpython on VC++ if
11+
* _DEBUG is defined */
12+
#undef _DEBUG
913
#include <Python.h>
14+
#define _DEBUG
15+
#else
16+
#include <Python.h>
17+
#endif
1018
#include "postgres.h"
1119

1220
/* system stuff */

src/port/open.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*
77
* Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
88
*
9-
* $PostgreSQL: pgsql/src/port/open.c,v 1.12 2006/03/05 15:59:10 momjian Exp $
9+
* $PostgreSQL: pgsql/src/port/open.c,v 1.13 2006/06/25 00:18:24 momjian Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -19,7 +19,7 @@
1919
#include <fcntl.h>
2020
#include <assert.h>
2121

22-
int win32_open(const char *fileName, int fileFlags,...);
22+
int pgwin32_open(const char *fileName, int fileFlags,...);
2323

2424
static int
2525
openFlagsToCreateFileFlags(int openFlags)
@@ -54,7 +54,7 @@ openFlagsToCreateFileFlags(int openFlags)
5454
* - handle other flags? (eg FILE_FLAG_NO_BUFFERING/FILE_FLAG_WRITE_THROUGH)
5555
*/
5656
int
57-
win32_open(const char *fileName, int fileFlags,...)
57+
pgwin32_open(const char *fileName, int fileFlags,...)
5858
{
5959
int fd;
6060
HANDLE h;

0 commit comments

Comments
 (0)