aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/include/c.h14
-rw-r--r--src/include/common/keywords.h6
-rw-r--r--src/include/common/pg_prng.h4
-rw-r--r--src/include/port/cygwin.h10
-rw-r--r--src/include/port/pg_bitutils.h6
-rw-r--r--src/include/port/win32.h14
6 files changed, 33 insertions, 21 deletions
diff --git a/src/include/c.h b/src/include/c.h
index c8ede082739..7e591171a84 100644
--- a/src/include/c.h
+++ b/src/include/c.h
@@ -1312,10 +1312,22 @@ extern long long strtoll(const char *str, char **endptr, int base);
extern unsigned long long strtoull(const char *str, char **endptr, int base);
#endif
-/* no special DLL markers on most ports */
+/*
+ * Use "extern PGDLLIMPORT ..." to declare variables that are defined
+ * in the core backend and need to be accessible by loadable modules.
+ * No special marking is required on most ports.
+ */
#ifndef PGDLLIMPORT
#define PGDLLIMPORT
#endif
+
+/*
+ * Use "extern PGDLLEXPORT ..." to declare functions that are defined in
+ * loadable modules and need to be callable by the core backend. (Usually,
+ * this is not necessary because our build process automatically exports
+ * such symbols, but sometimes manual marking is required.)
+ * No special marking is required on most ports.
+ */
#ifndef PGDLLEXPORT
#define PGDLLEXPORT
#endif
diff --git a/src/include/common/keywords.h b/src/include/common/keywords.h
index 19e4eda8f9e..d2e94e13d29 100644
--- a/src/include/common/keywords.h
+++ b/src/include/common/keywords.h
@@ -22,14 +22,8 @@
#define TYPE_FUNC_NAME_KEYWORD 2
#define RESERVED_KEYWORD 3
-#ifndef FRONTEND
extern PGDLLIMPORT const ScanKeywordList ScanKeywords;
extern PGDLLIMPORT const uint8 ScanKeywordCategories[];
extern PGDLLIMPORT const bool ScanKeywordBareLabel[];
-#else
-extern const ScanKeywordList ScanKeywords;
-extern const uint8 ScanKeywordCategories[];
-extern const bool ScanKeywordBareLabel[];
-#endif
#endif /* KEYWORDS_H */
diff --git a/src/include/common/pg_prng.h b/src/include/common/pg_prng.h
index e4df5165d7e..623c65ae731 100644
--- a/src/include/common/pg_prng.h
+++ b/src/include/common/pg_prng.h
@@ -26,11 +26,7 @@ typedef struct pg_prng_state
* Callers not needing local PRNG series may use this global state vector,
* after initializing it with one of the pg_prng_...seed functions.
*/
-#ifndef FRONTEND
extern PGDLLIMPORT pg_prng_state pg_global_prng_state;
-#else
-extern pg_prng_state pg_global_prng_state;
-#endif
extern void pg_prng_seed(pg_prng_state *state, uint64 seed);
extern void pg_prng_fseed(pg_prng_state *state, double fseed);
diff --git a/src/include/port/cygwin.h b/src/include/port/cygwin.h
index 64d69936e5e..44bf8533729 100644
--- a/src/include/port/cygwin.h
+++ b/src/include/port/cygwin.h
@@ -1,12 +1,18 @@
/* src/include/port/cygwin.h */
+/*
+ * Variables declared in the core backend and referenced by loadable
+ * modules need to be marked "dllimport" in the core build, but
+ * "dllexport" when the declaration is read in a loadable module.
+ * No special markings should be used when compiling frontend code.
+ */
+#ifndef FRONTEND
#ifdef BUILDING_DLL
#define PGDLLIMPORT __declspec (dllexport)
#else
#define PGDLLIMPORT __declspec (dllimport)
#endif
-
-#define PGDLLEXPORT
+#endif
/*
* Cygwin has a strtof() which is literally just (float)strtod(), which means
diff --git a/src/include/port/pg_bitutils.h b/src/include/port/pg_bitutils.h
index 7dd7fef4f74..d5078b54b30 100644
--- a/src/include/port/pg_bitutils.h
+++ b/src/include/port/pg_bitutils.h
@@ -13,15 +13,9 @@
#ifndef PG_BITUTILS_H
#define PG_BITUTILS_H
-#ifndef FRONTEND
extern PGDLLIMPORT const uint8 pg_leftmost_one_pos[256];
extern PGDLLIMPORT const uint8 pg_rightmost_one_pos[256];
extern PGDLLIMPORT const uint8 pg_number_of_ones[256];
-#else
-extern const uint8 pg_leftmost_one_pos[256];
-extern const uint8 pg_rightmost_one_pos[256];
-extern const uint8 pg_number_of_ones[256];
-#endif
/*
* pg_leftmost_one_pos32
diff --git a/src/include/port/win32.h b/src/include/port/win32.h
index d8ae49e22d1..c6213c77c3a 100644
--- a/src/include/port/win32.h
+++ b/src/include/port/win32.h
@@ -45,16 +45,26 @@
* defines for dynamic linking on Win32 platform
*/
+/*
+ * Variables declared in the core backend and referenced by loadable
+ * modules need to be marked "dllimport" in the core build, but
+ * "dllexport" when the declaration is read in a loadable module.
+ * No special markings should be used when compiling frontend code.
+ */
+#ifndef FRONTEND
#ifdef BUILDING_DLL
#define PGDLLIMPORT __declspec (dllexport)
#else
#define PGDLLIMPORT __declspec (dllimport)
#endif
+#endif
+/*
+ * Under MSVC, functions exported by a loadable module must be marked
+ * "dllexport". Other compilers don't need that.
+ */
#ifdef _MSC_VER
#define PGDLLEXPORT __declspec (dllexport)
-#else
-#define PGDLLEXPORT
#endif
/*