aboutsummaryrefslogtreecommitdiff
path: root/src/backend
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>2004-08-08 06:44:36 +0000
committerBruce Momjian <bruce@momjian.us>2004-08-08 06:44:36 +0000
commit7ee3c351522694dc6f8f0d6578394bdf5dec0b59 (patch)
treeca89b755bf06e58f99c44a2dee918b6c4bc23038 /src/backend
parent881ea47d248069a9597c292ca76891a67b1a6d6f (diff)
downloadpostgresql-7ee3c351522694dc6f8f0d6578394bdf5dec0b59.tar.gz
postgresql-7ee3c351522694dc6f8f0d6578394bdf5dec0b59.zip
Allow libpgport to call memory allocation routines even though
CurrentMemoryContext is DLLIMPORT on Win32. Work around that by creating stubs in the backend for palloc/pstrdup. Also fix pg_dumpall to do proper quoting on Win32.
Diffstat (limited to 'src/backend')
-rw-r--r--src/backend/utils/mmgr/mcxt.c37
1 files changed, 36 insertions, 1 deletions
diff --git a/src/backend/utils/mmgr/mcxt.c b/src/backend/utils/mmgr/mcxt.c
index 96ffb1a8e1c..28e9d26a2f9 100644
--- a/src/backend/utils/mmgr/mcxt.c
+++ b/src/backend/utils/mmgr/mcxt.c
@@ -14,7 +14,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/mmgr/mcxt.c,v 1.46 2004/07/01 00:51:29 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/mmgr/mcxt.c,v 1.47 2004/08/08 06:44:32 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -629,3 +629,38 @@ MemoryContextStrdup(MemoryContext context, const char *string)
return nstr;
}
+
+
+#ifdef WIN32
+/*
+ * Memory support routines for libpgport on Win32
+ *
+ * Win32 can't load a library that DLLIMPORTs a variable
+ * if the link object files also DLLIMPORT the same variable.
+ * For this reason, libpgport can't reference CurrentMemoryContext
+ * in the palloc macro calls.
+ *
+ * To fix this, we create several functions here that allow us to
+ * manage memory without doing the inline in libpgport.
+ */
+void *
+pgport_palloc(Size sz)
+{
+ return palloc(sz);
+}
+
+char *
+pgport_pstrdup(const char *str)
+{
+ return pstrdup(str);
+}
+
+
+/* Doesn't reference a DLLIMPORT variable, but here for completeness. */
+void
+pgport_pfree(void *pointer)
+{
+ pfree(pointer);
+ return;
+}
+#endif