From e1f9aa4eaecd8107230df1a1b698e8caf0fba4f8 Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <peter_e@gmx.net>
Date: Thu, 18 Aug 2011 12:53:32 +0300
Subject: [PATCH] Change PyInit_plpy to external linkage

Module initialization functions in Python 3 must have external
linkage, because PyMODINIT_FUNC does dllexport on Windows-like
platforms.  Without this change, the build with Python 3 fails on
Windows.
---
 src/pl/plpython/plpython.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/pl/plpython/plpython.c b/src/pl/plpython/plpython.c
index b981dec7c2e..17c583ec357 100644
--- a/src/pl/plpython/plpython.c
+++ b/src/pl/plpython/plpython.c
@@ -4066,7 +4066,13 @@ PLy_add_exceptions(PyObject *plpy)
 }
 
 #if PY_MAJOR_VERSION >= 3
-static PyMODINIT_FUNC
+/*
+ * Must have external linkage, because PyMODINIT_FUNC does dllexport on
+ * Windows-like platforms.
+ */
+PyMODINIT_FUNC PyInit_plpy(void);
+
+PyMODINIT_FUNC
 PyInit_plpy(void)
 {
 	PyObject   *m;
-- 
GitLab