Commit 53566fc0 authored by Noah Misch's avatar Noah Misch

MinGW: Link with shell32.dll instead of shfolder.dll.

This improves consistency with the MSVC build.  On buildfarm member
narwhal, since commit 846e91e0,
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 889f0381, which
adopted shfolder.dll for Windows NT 4.0 compatibility.  PostgreSQL 8.2
dropped support for that operating system.
parent 31dd7fcd
...@@ -549,10 +549,9 @@ LIBOBJS = @LIBOBJS@ ...@@ -549,10 +549,9 @@ LIBOBJS = @LIBOBJS@
LIBS := -lpgcommon -lpgport $(LIBS) LIBS := -lpgcommon -lpgport $(LIBS)
# to make ws2_32.lib the last library, and always link with shfolder, # to make ws2_32.lib the last library
# so SHGetFolderName isn't picked up from shell32.dll
ifeq ($(PORTNAME),win32) ifeq ($(PORTNAME),win32)
LIBS += -lws2_32 -lshfolder LIBS += -lws2_32
endif endif
# Not really standard libc functions, used by the backend. # Not really standard libc functions, used by the backend.
......
...@@ -39,11 +39,6 @@ SHLIB_PREREQS = submake-libpq submake-pgtypeslib ...@@ -39,11 +39,6 @@ SHLIB_PREREQS = submake-libpq submake-pgtypeslib
SHLIB_EXPORTS = exports.txt SHLIB_EXPORTS = exports.txt
ifeq ($(PORTNAME), win32)
# Link to shfolder.dll instead of shell32.dll
SHLIB_LINK += -lshfolder
endif
PKG_CONFIG_REQUIRES_PRIVATE = libpq libpgtypes PKG_CONFIG_REQUIRES_PRIVATE = libpq libpgtypes
all: all-lib all: all-lib
......
...@@ -74,7 +74,7 @@ else ...@@ -74,7 +74,7 @@ else
SHLIB_LINK += $(filter -lcrypt -ldes -lcom_err -lcrypto -lk5crypto -lkrb5 -lgssapi32 -lssl -lsocket -lnsl -lresolv -lintl $(PTHREAD_LIBS), $(LIBS)) $(LDAP_LIBS_FE) SHLIB_LINK += $(filter -lcrypt -ldes -lcom_err -lcrypto -lk5crypto -lkrb5 -lgssapi32 -lssl -lsocket -lnsl -lresolv -lintl $(PTHREAD_LIBS), $(LIBS)) $(LDAP_LIBS_FE)
endif endif
ifeq ($(PORTNAME), win32) ifeq ($(PORTNAME), win32)
SHLIB_LINK += -lshfolder -lws2_32 -lsecur32 $(filter -leay32 -lssleay32 -lcomerr32 -lkrb5_32, $(LIBS)) SHLIB_LINK += -lshell32 -lws2_32 -lsecur32 $(filter -leay32 -lssleay32 -lcomerr32 -lkrb5_32, $(LIBS))
endif endif
SHLIB_EXPORTS = exports.txt SHLIB_EXPORTS = exports.txt
......
...@@ -214,7 +214,7 @@ CPP_SBRS=. ...@@ -214,7 +214,7 @@ CPP_SBRS=.
RSC_PROJ=/l 0x409 /fo"$(INTDIR)\libpq.res" RSC_PROJ=/l 0x409 /fo"$(INTDIR)\libpq.res"
LINK32=link.exe LINK32=link.exe
LINK32_FLAGS=kernel32.lib user32.lib advapi32.lib shfolder.lib ws2_32.lib secur32.lib $(SSL_LIBS) $(KFW_LIB) $(ADD_SECLIB) \ LINK32_FLAGS=kernel32.lib user32.lib advapi32.lib shell32.lib ws2_32.lib secur32.lib $(SSL_LIBS) $(KFW_LIB) $(ADD_SECLIB) \
/nologo /subsystem:windows /dll $(LOPT) /incremental:no \ /nologo /subsystem:windows /dll $(LOPT) /incremental:no \
/pdb:"$(OUTDIR)\libpqdll.pdb" /machine:$(CPU) \ /pdb:"$(OUTDIR)\libpqdll.pdb" /machine:$(CPU) \
/out:"$(OUTDIR)\$(OUTFILENAME).dll"\ /out:"$(OUTDIR)\$(OUTFILENAME).dll"\
......
...@@ -785,9 +785,11 @@ get_home_path(char *ret_path) ...@@ -785,9 +785,11 @@ get_home_path(char *ret_path)
char *tmppath; char *tmppath;
/* /*
* Note: We use getenv here because the more modern * Note: We use getenv() here because the more modern SHGetFolderPath()
* SHGetSpecialFolderPath() will force us to link with shell32.lib which * would force the backend to link with shell32.lib, which eats valuable
* eats valuable desktop heap. * desktop heap. XXX This function is used only in psql, which already
* brings in shell32 via libpq. Moving this function to its own file
* would keep it out of the backend, freeing it from this concern.
*/ */
tmppath = getenv("APPDATA"); tmppath = getenv("APPDATA");
if (!tmppath) if (!tmppath)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment