Skip to content

Commit 53566fc

Browse files
committed
MinGW: Link with shell32.dll instead of shfolder.dll.
This improves consistency with the MSVC build. On buildfarm member narwhal, since commit 846e91e, shfolder.dll:SHGetFolderPath() crashes when dblink calls it by way of pqGetHomeDirectory(). Back-patch to 9.4, where that commit first appeared. How it caused this regression remains a mystery. This is a partial revert of commit 889f038, which adopted shfolder.dll for Windows NT 4.0 compatibility. PostgreSQL 8.2 dropped support for that operating system.
1 parent 31dd7fc commit 53566fc

File tree

5 files changed

+9
-13
lines changed

5 files changed

+9
-13
lines changed

src/Makefile.global.in

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -549,10 +549,9 @@ LIBOBJS = @LIBOBJS@
549549

550550
LIBS := -lpgcommon -lpgport $(LIBS)
551551

552-
# to make ws2_32.lib the last library, and always link with shfolder,
553-
# so SHGetFolderName isn't picked up from shell32.dll
552+
# to make ws2_32.lib the last library
554553
ifeq ($(PORTNAME),win32)
555-
LIBS += -lws2_32 -lshfolder
554+
LIBS += -lws2_32
556555
endif
557556

558557
# Not really standard libc functions, used by the backend.

src/interfaces/ecpg/ecpglib/Makefile

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,6 @@ SHLIB_PREREQS = submake-libpq submake-pgtypeslib
3939

4040
SHLIB_EXPORTS = exports.txt
4141

42-
ifeq ($(PORTNAME), win32)
43-
# Link to shfolder.dll instead of shell32.dll
44-
SHLIB_LINK += -lshfolder
45-
endif
46-
4742
PKG_CONFIG_REQUIRES_PRIVATE = libpq libpgtypes
4843

4944
all: all-lib

src/interfaces/libpq/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ else
7474
SHLIB_LINK += $(filter -lcrypt -ldes -lcom_err -lcrypto -lk5crypto -lkrb5 -lgssapi32 -lssl -lsocket -lnsl -lresolv -lintl $(PTHREAD_LIBS), $(LIBS)) $(LDAP_LIBS_FE)
7575
endif
7676
ifeq ($(PORTNAME), win32)
77-
SHLIB_LINK += -lshfolder -lws2_32 -lsecur32 $(filter -leay32 -lssleay32 -lcomerr32 -lkrb5_32, $(LIBS))
77+
SHLIB_LINK += -lshell32 -lws2_32 -lsecur32 $(filter -leay32 -lssleay32 -lcomerr32 -lkrb5_32, $(LIBS))
7878
endif
7979

8080
SHLIB_EXPORTS = exports.txt

src/interfaces/libpq/win32.mak

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ CPP_SBRS=.
214214
RSC_PROJ=/l 0x409 /fo"$(INTDIR)\libpq.res"
215215

216216
LINK32=link.exe
217-
LINK32_FLAGS=kernel32.lib user32.lib advapi32.lib shfolder.lib ws2_32.lib secur32.lib $(SSL_LIBS) $(KFW_LIB) $(ADD_SECLIB) \
217+
LINK32_FLAGS=kernel32.lib user32.lib advapi32.lib shell32.lib ws2_32.lib secur32.lib $(SSL_LIBS) $(KFW_LIB) $(ADD_SECLIB) \
218218
/nologo /subsystem:windows /dll $(LOPT) /incremental:no \
219219
/pdb:"$(OUTDIR)\libpqdll.pdb" /machine:$(CPU) \
220220
/out:"$(OUTDIR)\$(OUTFILENAME).dll"\

src/port/path.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -785,9 +785,11 @@ get_home_path(char *ret_path)
785785
char *tmppath;
786786

787787
/*
788-
* Note: We use getenv here because the more modern
789-
* SHGetSpecialFolderPath() will force us to link with shell32.lib which
790-
* eats valuable desktop heap.
788+
* Note: We use getenv() here because the more modern SHGetFolderPath()
789+
* would force the backend to link with shell32.lib, which eats valuable
790+
* desktop heap. XXX This function is used only in psql, which already
791+
* brings in shell32 via libpq. Moving this function to its own file
792+
* would keep it out of the backend, freeing it from this concern.
791793
*/
792794
tmppath = getenv("APPDATA");
793795
if (!tmppath)

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