Skip to content

Commit f34240d

Browse files
committed
Changes to fix/improve the dynamic loading on NT From: Horak Daniel <horak@mmp.plzen-city.cz>
1 parent f7430af commit f34240d

File tree

6 files changed

+33
-10
lines changed

6 files changed

+33
-10
lines changed

src/backend/commands/trigger.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
#include "utils/acl.h"
3636
#endif
3737

38-
TriggerData *CurrentTriggerData = NULL;
38+
DLLIMPORT TriggerData *CurrentTriggerData = NULL;
3939

4040
void RelationBuildTriggers(Relation relation);
4141
void FreeTriggerDesc(Relation relation);

src/backend/executor/spi.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* spi.c
44
* Server Programming Interface
55
*
6-
* $Id: spi.c,v 1.34 1999/02/13 23:15:30 momjian Exp $
6+
* $Id: spi.c,v 1.35 1999/03/09 13:39:00 scrappy Exp $
77
*
88
*-------------------------------------------------------------------------
99
*/
@@ -19,9 +19,9 @@ static _SPI_connection *_SPI_current = NULL;
1919
static int _SPI_connected = -1;
2020
static int _SPI_curid = -1;
2121

22-
uint32 SPI_processed = 0;
23-
SPITupleTable *SPI_tuptable;
24-
int SPI_result;
22+
DLLIMPORT uint32 SPI_processed = 0;
23+
DLLIMPORT SPITupleTable *SPI_tuptable;
24+
DLLIMPORT int SPI_result;
2525

2626
static int _SPI_execute(char *src, int tcount, _SPI_plan *plan);
2727
static int _SPI_pquery(QueryDesc *queryDesc, EState *state, int tcount);

src/include/c.h

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
* Copyright (c) 1994, Regents of the University of California
99
*
10-
* $Id: c.h,v 1.51 1999/02/13 23:20:44 momjian Exp $
10+
* $Id: c.h,v 1.52 1999/03/09 13:39:01 scrappy Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -57,6 +57,10 @@
5757
#include <errno.h>
5858
#endif
5959

60+
#ifdef __CYGWIN32__
61+
#include <errno.h>
62+
#endif
63+
6064
/* ----------------------------------------------------------------
6165
* Section 1: bool, true, false, TRUE, FALSE
6266
* ----------------------------------------------------------------
@@ -829,6 +833,20 @@ extern char *form(const char *fmt,...);
829833
#define COPY_CMD "cp"
830834
#define SEP_CHAR '/'
831835

836+
/* defines for dynamic linking on Win32 platform */
837+
#ifdef __CYGWIN32__
838+
#if __GNUC__ && ! defined (__declspec)
839+
#error You need egcs 1.1 or newer for compiling!
840+
#endif
841+
#ifdef BUILDING_DLL
842+
#define DLLIMPORT __declspec (dllexport)
843+
#else /* not BUILDING_DLL */
844+
#define DLLIMPORT __declspec (dllimport)
845+
#endif
846+
#else /* not CYGWIN */
847+
#define DLLIMPORT
848+
#endif
849+
832850
/* Provide prototypes for routines not present in a particular machine's
833851
* standard C library. It'd be better to put these in config.h, but
834852
* in config.h we haven't yet included anything that defines size_t...

src/include/commands/trigger.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ typedef struct TriggerData
2626
Trigger *tg_trigger;
2727
} TriggerData;
2828

29-
extern TriggerData *CurrentTriggerData;
29+
extern DLLIMPORT TriggerData *CurrentTriggerData;
3030

3131
#define TRIGGER_EVENT_INSERT 0x00000000
3232
#define TRIGGER_EVENT_DELETE 0x00000001

src/include/executor/spi.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,9 @@ typedef struct
6666
#define SPI_OK_UPDATE 9
6767
#define SPI_OK_CURSOR 10
6868

69-
extern uint32 SPI_processed;
70-
extern SPITupleTable *SPI_tuptable;
71-
extern int SPI_result;
69+
extern DLLIMPORT uint32 SPI_processed;
70+
extern DLLIMPORT SPITupleTable *SPI_tuptable;
71+
extern DLLIMPORT int SPI_result;
7272

7373
extern int SPI_connect(void);
7474
extern int SPI_finish(void);

src/makefiles/Makefile.win

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,8 @@ SHLIB_LINK=$(DLLLIBS)
1313
$(DLLTOOL) --export-all --output-def $*.def $<
1414
$(DLLWRAP) -o $@ --def $*.def $< $(SRCDIR)/utils/dllinit.o $(DLLLIBS)
1515
rm -f $*.def
16+
17+
curdir:=$(shell pwd)
18+
ifeq ($(findstring backend,$(curdir)), backend)
19+
CFLAGS+= -DBUILDING_DLL=1
20+
endif

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy