From e6c7ff9e381bf2b9a0c5170c8ddd309dafa1783b Mon Sep 17 00:00:00 2001 From: Robert Haas Date: Tue, 5 Dec 2017 09:24:12 -0500 Subject: [PATCH] Mark assorted variables PGDLLIMPORT. This makes life easier for extension authors who wish to support Windows. Brian Cloutier, slightly amended by me. Discussion: http://postgr.es/m/CAJCy68fscdNhmzFPS4kyO00CADkvXvEa-28H-OtENk-pa2OTWw@mail.gmail.com --- src/include/access/twophase.h | 2 +- src/include/commands/extension.h | 4 ++-- src/include/miscadmin.h | 8 ++++---- src/include/pgtime.h | 2 +- src/include/postmaster/postmaster.h | 4 ++-- src/include/storage/fd.h | 2 +- src/include/storage/proc.h | 4 ++-- src/include/tcop/dest.h | 3 ++- src/include/tcop/tcopprot.h | 2 +- src/include/utils/guc.h | 6 +++--- src/include/utils/snapmgr.h | 6 +++--- 11 files changed, 22 insertions(+), 21 deletions(-) diff --git a/src/include/access/twophase.h b/src/include/access/twophase.h index 15aec35708c..8a5b700b3da 100644 --- a/src/include/access/twophase.h +++ b/src/include/access/twophase.h @@ -25,7 +25,7 @@ typedef struct GlobalTransactionData *GlobalTransaction; /* GUC variable */ -extern int max_prepared_xacts; +extern PGDLLIMPORT int max_prepared_xacts; extern Size TwoPhaseShmemSize(void); extern void TwoPhaseShmemInit(void); diff --git a/src/include/commands/extension.h b/src/include/commands/extension.h index bf981682fc9..90083014e2e 100644 --- a/src/include/commands/extension.h +++ b/src/include/commands/extension.h @@ -23,8 +23,8 @@ * on the current pg_extension object for each SQL object created by its * installation script. */ -extern bool creating_extension; -extern Oid CurrentExtensionObject; +extern PGDLLIMPORT bool creating_extension; +extern PGDLLIMPORT Oid CurrentExtensionObject; extern Oid CreateExtension(CreateExtensionStmt *stmt); diff --git a/src/include/miscadmin.h b/src/include/miscadmin.h index d0ec3914e08..7067691c35a 100644 --- a/src/include/miscadmin.h +++ b/src/include/miscadmin.h @@ -150,13 +150,13 @@ extern PGDLLIMPORT bool IsUnderPostmaster; extern bool IsBackgroundWorker; extern bool IsBinaryUpgrade; -extern bool ExitOnAnyError; +extern PGDLLIMPORT bool ExitOnAnyError; extern PGDLLIMPORT char *DataDir; extern PGDLLIMPORT int NBuffers; -extern int MaxBackends; -extern int MaxConnections; +extern PGDLLIMPORT int MaxBackends; +extern PGDLLIMPORT int MaxConnections; extern PGDLLIMPORT int MyProcPid; extern PGDLLIMPORT pg_time_t MyStartTime; @@ -244,7 +244,7 @@ extern int CTimeZone; #define MAXTZLEN 10 /* max TZ name len, not counting tr. null */ extern bool enableFsync; -extern bool allowSystemTableMods; +extern PGDLLIMPORT bool allowSystemTableMods; extern PGDLLIMPORT int work_mem; extern PGDLLIMPORT int maintenance_work_mem; diff --git a/src/include/pgtime.h b/src/include/pgtime.h index c0ab639ad4b..6c1336da083 100644 --- a/src/include/pgtime.h +++ b/src/include/pgtime.h @@ -70,7 +70,7 @@ extern size_t pg_strftime(char *s, size_t max, const char *format, /* these functions and variables are in pgtz.c */ -extern pg_tz *session_timezone; +extern PGDLLIMPORT pg_tz *session_timezone; extern pg_tz *log_timezone; extern void pg_timezone_initialize(void); diff --git a/src/include/postmaster/postmaster.h b/src/include/postmaster/postmaster.h index c090595a45a..72c31aa3305 100644 --- a/src/include/postmaster/postmaster.h +++ b/src/include/postmaster/postmaster.h @@ -16,7 +16,7 @@ /* GUC options */ extern bool EnableSSL; extern int ReservedBackends; -extern int PostPortNumber; +extern PGDLLIMPORT int PostPortNumber; extern int Unix_socket_permissions; extern char *Unix_socket_group; extern char *Unix_socket_directories; @@ -44,7 +44,7 @@ extern int postmaster_alive_fds[2]; #define POSTMASTER_FD_OWN 1 /* kept open by postmaster only */ #endif -extern const char *progname; +extern PGDLLIMPORT const char *progname; extern void PostmasterMain(int argc, char *argv[]) __attribute__((noreturn)); extern void ClosePostmasterPorts(bool am_syslogger); diff --git a/src/include/storage/fd.h b/src/include/storage/fd.h index 4c60f821bed..c5075d83f4a 100644 --- a/src/include/storage/fd.h +++ b/src/include/storage/fd.h @@ -52,7 +52,7 @@ typedef int File; /* GUC parameter */ -extern int max_files_per_process; +extern PGDLLIMPORT int max_files_per_process; /* * This is private to fd.c, but exported for save/restore_backend_variables() diff --git a/src/include/storage/proc.h b/src/include/storage/proc.h index 84d0b91debe..63a22179ead 100644 --- a/src/include/storage/proc.h +++ b/src/include/storage/proc.h @@ -204,7 +204,7 @@ typedef struct PROC_HDR int startupBufferPinWaitBufId; } PROC_HDR; -extern PROC_HDR *ProcGlobal; +extern PGDLLIMPORT PROC_HDR *ProcGlobal; extern PGPROC *PreparedXactProcs; @@ -220,7 +220,7 @@ extern PGPROC *PreparedXactProcs; /* configurable options */ -extern int DeadlockTimeout; +extern PGDLLIMPORT int DeadlockTimeout; extern int StatementTimeout; extern int LockTimeout; extern bool log_lock_waits; diff --git a/src/include/tcop/dest.h b/src/include/tcop/dest.h index 5dd623bc35c..621ee3acc30 100644 --- a/src/include/tcop/dest.h +++ b/src/include/tcop/dest.h @@ -125,7 +125,8 @@ struct _DestReceiver /* Private fields might appear beyond this point... */ }; -extern DestReceiver *None_Receiver; /* permanent receiver for DestNone */ +extern PGDLLIMPORT DestReceiver *None_Receiver; /* permanent receiver for + * DestNone */ /* The primary destination management functions */ diff --git a/src/include/tcop/tcopprot.h b/src/include/tcop/tcopprot.h index 035a442e35f..68d5ca90fb1 100644 --- a/src/include/tcop/tcopprot.h +++ b/src/include/tcop/tcopprot.h @@ -44,7 +44,7 @@ typedef enum LOGSTMT_ALL /* log all statements */ } LogStmtLevel; -extern int log_statement; +extern PGDLLIMPORT int log_statement; extern List *pg_parse_query(const char *query_string); extern List *pg_analyze_and_rewrite(Node *parsetree, const char *query_string, diff --git a/src/include/utils/guc.h b/src/include/utils/guc.h index b5dd72c5b0a..d5bbd6bcf6c 100644 --- a/src/include/utils/guc.h +++ b/src/include/utils/guc.h @@ -210,8 +210,8 @@ extern bool default_with_oids; extern bool SQL_inheritance; extern int log_min_error_statement; -extern int log_min_messages; -extern int client_min_messages; +extern PGDLLIMPORT int log_min_messages; +extern PGDLLIMPORT int client_min_messages; extern int log_min_duration_statement; extern int log_temp_files; @@ -220,7 +220,7 @@ extern int temp_file_limit; extern int num_temp_buffers; extern char *data_directory; -extern char *ConfigFileName; +extern PGDLLIMPORT char *ConfigFileName; extern char *HbaFileName; extern char *IdentFileName; extern char *external_pid_file; diff --git a/src/include/utils/snapmgr.h b/src/include/utils/snapmgr.h index bfbd8dd8ff5..ba254231cc8 100644 --- a/src/include/utils/snapmgr.h +++ b/src/include/utils/snapmgr.h @@ -20,9 +20,9 @@ extern bool FirstSnapshotSet; -extern TransactionId TransactionXmin; -extern TransactionId RecentXmin; -extern TransactionId RecentGlobalXmin; +extern PGDLLIMPORT TransactionId TransactionXmin; +extern PGDLLIMPORT TransactionId RecentXmin; +extern PGDLLIMPORT TransactionId RecentGlobalXmin; extern Snapshot GetTransactionSnapshot(void); extern Snapshot GetLatestSnapshot(void);