Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit c7add81

Browse files
committed
Export only required symbols in libpq on Win32.
Magnus Hagander
1 parent 88fd162 commit c7add81

File tree

7 files changed

+41
-4
lines changed

7 files changed

+41
-4
lines changed

src/Makefile.shlib

+13-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# Copyright (c) 1998, Regents of the University of California
77
#
88
# IDENTIFICATION
9-
# $PostgreSQL: pgsql/src/Makefile.shlib,v 1.85 2004/10/15 05:11:00 momjian Exp $
9+
# $PostgreSQL: pgsql/src/Makefile.shlib,v 1.86 2004/10/16 03:26:43 momjian Exp $
1010
#
1111
#-------------------------------------------------------------------------
1212

@@ -31,6 +31,8 @@
3131
# DLLTOOL_DEFFLAGS Additional flags when creating the dll .def file
3232
# DLLTOOL_LIBFLAGS Additional flags when creating the lib<module>.a file
3333
# DLLWRAP_FLAGS Additional flags to dllwrap
34+
# DLL_DEFFILE Use pre-existing .def file instead of auto-generating
35+
# one with all exports in it (win32 only).
3436
#
3537
# The module Makefile must also include
3638
# $(top_builddir)/src/Makefile.global before including this file.
@@ -306,19 +308,29 @@ else # PORTNAME == cygwin
306308

307309
# Cygwin case
308310
$(shlib) lib$(NAME).a: $(OBJS)
311+
ifndef DLL_DEFFILE
309312
$(DLLTOOL) --export-all $(DLLTOOL_DEFFLAGS) --output-def $(NAME).def $(OBJS)
310313
$(DLLWRAP) $(LDFLAGS_SL) -o $(shlib) --dllname $(shlib) $(DLLWRAP_FLAGS) --def $(NAME).def $(OBJS) $(SHLIB_LINK)
311314
$(DLLTOOL) --dllname $(shlib) $(DLLTOOL_LIBFLAGS) --def $(NAME).def --output-lib lib$(NAME).a
315+
else
316+
$(DLLWRAP) $(LDFLAGS_SL) -o $(shlib) --dllname $(shlib) $(DLLWRAP_FLAGS) --def $(DLL_DEFFILE) $(OBJS) $(SHLIB_LINK)
317+
$(DLLTOOL) --dllname $(shlib) $(DLLTOOL_LIBFLAGS) --def $(DLL_DEFFILE) --output-lib lib$(NAME).a
318+
endif
312319

313320
endif # PORTNAME == cygwin
314321

315322
else # PORTNAME == win32
316323

317324
# win32 case
318325
$(shlib) lib$(NAME).a: $(OBJS)
326+
ifndef DLL_DEFFILE
319327
$(DLLTOOL) --export-all $(DLLTOOL_DEFFLAGS) --output-def $(NAME).def $(OBJS)
320328
$(DLLWRAP) $(LDFLAGS_SL) -o $(shlib) --dllname $(shlib) $(DLLWRAP_FLAGS) --def $(NAME).def $(OBJS) $(SHLIB_LINK)
321329
$(DLLTOOL) --dllname $(shlib) $(DLLTOOL_LIBFLAGS) --def $(NAME).def --output-lib lib$(NAME).a
330+
else
331+
$(DLLWRAP) $(LDFLAGS_SL) -o $(shlib) --dllname $(shlib) $(DLLWRAP_FLAGS) --def $(DLL_DEFFILE) $(OBJS) $(SHLIB_LINK)
332+
$(DLLTOOL) --dllname $(shlib) $(DLLTOOL_LIBFLAGS) --def $(DLL_DEFFILE) --output-lib lib$(NAME).a
333+
endif
322334

323335
endif # PORTNAME == win32
324336

src/interfaces/libpq/Makefile

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#
55
# Copyright (c) 1994, Regents of the University of California
66
#
7-
# $PostgreSQL: pgsql/src/interfaces/libpq/Makefile,v 1.117 2004/10/12 04:48:36 neilc Exp $
7+
# $PostgreSQL: pgsql/src/interfaces/libpq/Makefile,v 1.118 2004/10/16 03:26:43 momjian Exp $
88
#
99
#-------------------------------------------------------------------------
1010

@@ -34,6 +34,7 @@ ifeq ($(PORTNAME), win32)
3434
OBJS += win32.o libpqrc.o
3535
libpqrc.o : libpq.rc
3636
windres -i libpq.rc -o libpqrc.o
37+
DLL_DEFFILE=libpqdll.def
3738
ifeq ($(enable_thread_safety), yes)
3839
# This doesn't work yet because configure test fails. 2004-06-19
3940
OBJS += pthread-win32.o

src/interfaces/libpq/blibpqdll.def

+8
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,10 @@ EXPORTS
115115
_PQsendQueryPrepared @ 111
116116
_PQdsplen @ 112
117117
_PQserverVersion @ 113
118+
_PQgetssl @ 114
119+
_pg_char_to_encoding @ 115
120+
_pg_valid_server_encoding @ 116
121+
_pqsignal @ 117
118122

119123
; Aliases for MS compatible names
120124
PQconnectdb = _PQconnectdb
@@ -230,3 +234,7 @@ EXPORTS
230234
PQsendQueryPrepared = _PQsendQueryPrepared
231235
PQdsplen = _PQdsplen
232236
PQserverVersion = _PQserverVersion
237+
PQgetssl = _PQgetssl
238+
pg_char_to_encoding = _pg_char_to_encoding
239+
pg_valid_server_encoding = _pg_valid_server_encoding
240+
pqsignal = _pqsignal

src/interfaces/libpq/fe-secure.c

+7-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
*
1212
*
1313
* IDENTIFICATION
14-
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-secure.c,v 1.54 2004/09/28 00:06:02 momjian Exp $
14+
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-secure.c,v 1.55 2004/10/16 03:26:43 momjian Exp $
1515
*
1616
* NOTES
1717
* [ Most of these notes are wrong/obsolete, but perhaps not all ]
@@ -1201,6 +1201,12 @@ PQgetssl(PGconn *conn)
12011201
return NULL;
12021202
return conn->ssl;
12031203
}
1204+
#else
1205+
void *
1206+
PQgetssl(PGconn *conn)
1207+
{
1208+
return NULL;
1209+
}
12041210
#endif /* USE_SSL */
12051211

12061212

src/interfaces/libpq/libpq-fe.h

+3-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1996-2004, PostgreSQL Global Development Group
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
10-
* $PostgreSQL: pgsql/src/interfaces/libpq/libpq-fe.h,v 1.109 2004/10/16 03:10:17 momjian Exp $
10+
* $PostgreSQL: pgsql/src/interfaces/libpq/libpq-fe.h,v 1.110 2004/10/16 03:26:43 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -258,6 +258,8 @@ extern int PQsetClientEncoding(PGconn *conn, const char *encoding);
258258
#ifdef USE_SSL
259259
/* Get the SSL structure associated with a connection */
260260
extern SSL *PQgetssl(PGconn *conn);
261+
#else
262+
extern void *PQgetssl(PGconn *conn);
261263
#endif
262264

263265
/* Set verbosity for PQerrorMessage and PQresultErrorMessage */

src/interfaces/libpq/libpqddll.def

+4
Original file line numberDiff line numberDiff line change
@@ -115,3 +115,7 @@ EXPORTS
115115
PQsendQueryPrepared @ 111
116116
PQdsplen @ 112
117117
PQserverVersion @ 113
118+
PQgetssl @ 114
119+
pg_char_to_encoding @ 115
120+
pg_valid_server_encoding @ 116
121+
pqsignal @ 117

src/interfaces/libpq/libpqdll.def

+4
Original file line numberDiff line numberDiff line change
@@ -115,3 +115,7 @@ EXPORTS
115115
PQsendQueryPrepared @ 111
116116
PQdsplen @ 112
117117
PQserverVersion @ 113
118+
PQgetssl @ 114
119+
pg_char_to_encoding @ 115
120+
pg_valid_server_encoding @ 116
121+
pqsignal @ 117

0 commit comments

Comments
 (0)