diff --git a/src/include/port/cygwin.h b/src/include/port/cygwin.h
index d3ae74b1bf5b84afd71d436f597db28dd482bf2a..c703f59c62b28eb1d4e2214331ac3e8204cb71dc 100644
--- a/src/include/port/cygwin.h
+++ b/src/include/port/cygwin.h
@@ -1,6 +1,4 @@
-/* $Header: /cvsroot/pgsql/src/include/port/cygwin.h,v 1.2 2003/04/18 01:03:42 momjian Exp $ */
-
-#include <port/win32defs.h>
+/* $Header: /cvsroot/pgsql/src/include/port/cygwin.h,v 1.3 2003/05/22 17:20:28 petere Exp $ */
 
 #define HAS_TEST_AND_SET
 typedef unsigned char slock_t;
diff --git a/src/include/utils/elog.h b/src/include/utils/elog.h
index 5a3f7ae33809dd94881cfe0635d4a419b134e99a..976198495b34e3df8013485bec253cd8fed94c98 100644
--- a/src/include/utils/elog.h
+++ b/src/include/utils/elog.h
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: elog.h,v 1.42 2003/05/15 16:35:29 momjian Exp $
+ * $Id: elog.h,v 1.43 2003/05/22 17:20:43 petere Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -264,7 +264,7 @@ typedef struct ErrorContextCallback
 	void *arg;
 } ErrorContextCallback;
 
-extern ErrorContextCallback *error_context_stack;
+extern DLLIMPORT ErrorContextCallback *error_context_stack;
 
 
 /* GUC-configurable parameters */
diff --git a/src/interfaces/ecpg/Makefile b/src/interfaces/ecpg/Makefile
index 74286ce6ece54a662322801e0c6733d486a8fc68..35fe094adfaf87606d7c8d75e8ab1fea5aa525e2 100644
--- a/src/interfaces/ecpg/Makefile
+++ b/src/interfaces/ecpg/Makefile
@@ -4,15 +4,15 @@ include $(top_builddir)/src/Makefile.global
 
 all install installdirs uninstall dep depend distprep:
 	$(MAKE) -C include $@
-	$(MAKE) -C ecpglib $@
 	$(MAKE) -C pgtypeslib $@
+	$(MAKE) -C ecpglib $@
 	$(MAKE) -C compatlib $@
 	$(MAKE) -C preproc $@
 
 clean distclean maintainer-clean:
 	-$(MAKE) -C include $@
-	-$(MAKE) -C ecpglib $@
 	-$(MAKE) -C pgtypeslib $@
+	-$(MAKE) -C ecpglib $@
 	-$(MAKE) -C compatlib $@
 	-$(MAKE) -C preproc $@
 	-$(MAKE) -C test clean
diff --git a/src/interfaces/ecpg/compatlib/Makefile b/src/interfaces/ecpg/compatlib/Makefile
index c7bc8ef84ec1bb1ae7ab1f70289620e842128c53..b87275c6f5e04db4a943ff496035d56b3112acd2 100644
--- a/src/interfaces/ecpg/compatlib/Makefile
+++ b/src/interfaces/ecpg/compatlib/Makefile
@@ -4,7 +4,7 @@
 #
 # Copyright (c) 1994, Regents of the University of California
 #
-# $Header: /cvsroot/pgsql/src/interfaces/ecpg/compatlib/Makefile,v 1.3 2003/04/16 05:23:55 tgl Exp $
+# $Header: /cvsroot/pgsql/src/interfaces/ecpg/compatlib/Makefile,v 1.4 2003/05/22 17:20:44 petere Exp $
 #
 #-------------------------------------------------------------------------
 
@@ -17,6 +17,7 @@ SO_MAJOR_VERSION= 1
 SO_MINOR_VERSION= 0.0
 
 override CPPFLAGS := -I$(top_srcdir)/src/interfaces/ecpg/include -I$(top_srcdir)/src/include/utils $(CPPFLAGS)
+SHLIB_LINK = -L../pgtypeslib -lpgtypes
 
 OBJS= informix.o
 
diff --git a/src/interfaces/ecpg/compatlib/informix.c b/src/interfaces/ecpg/compatlib/informix.c
index 27d2f9acd794cd915449b7841f9d9ede4a9a58c8..078cc1b29599c8ffbeb4c6b7e2448b98ac05a691 100644
--- a/src/interfaces/ecpg/compatlib/informix.c
+++ b/src/interfaces/ecpg/compatlib/informix.c
@@ -55,7 +55,7 @@ deccopy(Numeric *src, Numeric *target)
 }
 
 static char *
-strndup(char *str, int len)
+strndup(const char *str, size_t len)
 {
 	int real_len = strlen(str);
 	int use_len = (real_len > len) ? len : real_len;
diff --git a/src/interfaces/ecpg/ecpglib/Makefile b/src/interfaces/ecpg/ecpglib/Makefile
index 6b47cf695e51a40fd0e63e015a7c72ef30671245..269f2d1461329f210ea8d51b7bd4fecf445dc627 100644
--- a/src/interfaces/ecpg/ecpglib/Makefile
+++ b/src/interfaces/ecpg/ecpglib/Makefile
@@ -4,7 +4,7 @@
 #
 # Copyright (c) 1994, Regents of the University of California
 #
-# $Header: /cvsroot/pgsql/src/interfaces/ecpg/ecpglib/Makefile,v 1.2 2003/04/08 17:09:01 tgl Exp $
+# $Header: /cvsroot/pgsql/src/interfaces/ecpg/ecpglib/Makefile,v 1.3 2003/05/22 17:20:44 petere Exp $
 #
 #-------------------------------------------------------------------------
 
@@ -21,7 +21,7 @@ override CPPFLAGS := -I$(top_srcdir)/src/interfaces/ecpg/include -I$(libpq_srcdi
 OBJS= execute.o typename.o descriptor.o data.o error.o prepare.o memory.o \
 	connect.o misc.o
 
-SHLIB_LINK= $(libpq)
+SHLIB_LINK = -L../pgtypeslib -lpgtypes $(libpq)
 
 all: all-lib
 
diff --git a/src/makefiles/Makefile.cygwin b/src/makefiles/Makefile.cygwin
index d5bcf9f7d892c5187e3c851b42a088005e9b4d52..30b5ceb54548f0622a7474e75560a4ae57c97eb3 100644
--- a/src/makefiles/Makefile.cygwin
+++ b/src/makefiles/Makefile.cygwin
@@ -1,4 +1,4 @@
-# $Header: /cvsroot/pgsql/src/makefiles/Makefile.cygwin,v 1.1 2003/03/21 17:18:34 petere Exp $
+# $Header: /cvsroot/pgsql/src/makefiles/Makefile.cygwin,v 1.2 2003/05/22 17:20:44 petere Exp $
 DLLTOOL= dlltool
 DLLWRAP= dllwrap
 BE_DLLLIBS= -L$(top_builddir)/src/backend -lpostgres
@@ -23,7 +23,7 @@ override CPPFLAGS+= -DBUILDING_DLL
 endif
 endif
 
-ifneq (,$(findstring ecpg/lib,$(subdir)))
+ifneq (,$(findstring ecpg/ecpglib,$(subdir)))
 override CPPFLAGS+= -DBUILDING_DLL
 endif