Skip to content

Commit 8ec5694

Browse files
committed
Apply PGDLLIMPORT markings broadly.
Up until now, we've had a policy of only marking certain variables in the PostgreSQL header files with PGDLLIMPORT, but now we've decided to mark them all. This means that extensions running on Windows should no longer operate at a disadvantage as compared to extensions running on Linux: if the variable is present in a header file, it should be accessible. Discussion: http://postgr.es/m/CA+TgmoYanc1_FSfimhgiWSqVyP5KKmh5NP2BWNwDhO8Pg2vGYQ@mail.gmail.com
1 parent 80900d4 commit 8ec5694

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

100 files changed

+434
-429
lines changed

src/include/access/gin.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ typedef char GinTernaryValue;
6868

6969
/* GUC parameters */
7070
extern PGDLLIMPORT int GinFuzzySearchLimit;
71-
extern int gin_pending_list_limit;
71+
extern PGDLLIMPORT int gin_pending_list_limit;
7272

7373
/* ginutil.c */
7474
extern void ginGetStats(Relation index, GinStatsData *stats);

src/include/access/parallel.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ typedef struct ParallelWorkerContext
5454
shm_toc *toc;
5555
} ParallelWorkerContext;
5656

57-
extern volatile bool ParallelMessagePending;
57+
extern PGDLLIMPORT volatile bool ParallelMessagePending;
5858
extern PGDLLIMPORT int ParallelWorkerNumber;
5959
extern PGDLLIMPORT bool InitializingParallelWorker;
6060

src/include/access/session.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,6 @@ extern void AttachSession(dsm_handle handle);
3939
extern void DetachSession(void);
4040

4141
/* The current session, or NULL for none. */
42-
extern Session *CurrentSession;
42+
extern PGDLLIMPORT Session *CurrentSession;
4343

4444
#endif /* SESSION_H */

src/include/access/tableam.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@
2828
#define DEFAULT_TABLE_ACCESS_METHOD "heap"
2929

3030
/* GUCs */
31-
extern char *default_table_access_method;
32-
extern bool synchronize_seqscans;
31+
extern PGDLLIMPORT char *default_table_access_method;
32+
extern PGDLLIMPORT bool synchronize_seqscans;
3333

3434

3535
struct BulkInsertStateData;

src/include/access/toast_compression.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
* but the value is one of the char values defined below, as they appear in
2121
* pg_attribute.attcompression, e.g. TOAST_PGLZ_COMPRESSION.
2222
*/
23-
extern int default_toast_compression;
23+
extern PGDLLIMPORT int default_toast_compression;
2424

2525
/*
2626
* Built-in compression method ID. The toast compression header will store

src/include/access/twophase_rmgr.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ typedef uint8 TwoPhaseRmgrId;
2828
#define TWOPHASE_RM_PREDICATELOCK_ID 4
2929
#define TWOPHASE_RM_MAX_ID TWOPHASE_RM_PREDICATELOCK_ID
3030

31-
extern const TwoPhaseCallback twophase_recover_callbacks[];
32-
extern const TwoPhaseCallback twophase_postcommit_callbacks[];
33-
extern const TwoPhaseCallback twophase_postabort_callbacks[];
34-
extern const TwoPhaseCallback twophase_standby_recover_callbacks[];
31+
extern PGDLLIMPORT const TwoPhaseCallback twophase_recover_callbacks[];
32+
extern PGDLLIMPORT const TwoPhaseCallback twophase_postcommit_callbacks[];
33+
extern PGDLLIMPORT const TwoPhaseCallback twophase_postabort_callbacks[];
34+
extern PGDLLIMPORT const TwoPhaseCallback twophase_standby_recover_callbacks[];
3535

3636

3737
extern void RegisterTwoPhaseRecord(TwoPhaseRmgrId rmid, uint16 info,

src/include/access/xact.h

+8-8
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
#define XACT_REPEATABLE_READ 2
3939
#define XACT_SERIALIZABLE 3
4040

41-
extern int DefaultXactIsoLevel;
41+
extern PGDLLIMPORT int DefaultXactIsoLevel;
4242
extern PGDLLIMPORT int XactIsoLevel;
4343

4444
/*
@@ -52,18 +52,18 @@ extern PGDLLIMPORT int XactIsoLevel;
5252
#define IsolationIsSerializable() (XactIsoLevel == XACT_SERIALIZABLE)
5353

5454
/* Xact read-only state */
55-
extern bool DefaultXactReadOnly;
56-
extern bool XactReadOnly;
55+
extern PGDLLIMPORT bool DefaultXactReadOnly;
56+
extern PGDLLIMPORT bool XactReadOnly;
5757

5858
/* flag for logging statements in this transaction */
59-
extern bool xact_is_sampled;
59+
extern PGDLLIMPORT bool xact_is_sampled;
6060

6161
/*
6262
* Xact is deferrable -- only meaningful (currently) for read only
6363
* SERIALIZABLE transactions
6464
*/
65-
extern bool DefaultXactDeferrable;
66-
extern bool XactDeferrable;
65+
extern PGDLLIMPORT bool DefaultXactDeferrable;
66+
extern PGDLLIMPORT bool XactDeferrable;
6767

6868
typedef enum
6969
{
@@ -80,7 +80,7 @@ typedef enum
8080
#define SYNCHRONOUS_COMMIT_ON SYNCHRONOUS_COMMIT_REMOTE_FLUSH
8181

8282
/* Synchronous commit level */
83-
extern int synchronous_commit;
83+
extern PGDLLIMPORT int synchronous_commit;
8484

8585
/* used during logical streaming of a transaction */
8686
extern PGDLLIMPORT TransactionId CheckXidAlive;
@@ -93,7 +93,7 @@ extern PGDLLIMPORT bool bsysscan;
9393
* globally accessible, so can be set from anywhere in the code which requires
9494
* recording flags.
9595
*/
96-
extern int MyXactFlags;
96+
extern PGDLLIMPORT int MyXactFlags;
9797

9898
/*
9999
* XACT_FLAGS_ACCESSEDTEMPNAMESPACE - set when a temporary object is accessed.

src/include/access/xlog.h

+28-28
Original file line numberDiff line numberDiff line change
@@ -24,35 +24,35 @@
2424
#define SYNC_METHOD_OPEN 2 /* for O_SYNC */
2525
#define SYNC_METHOD_FSYNC_WRITETHROUGH 3
2626
#define SYNC_METHOD_OPEN_DSYNC 4 /* for O_DSYNC */
27-
extern int sync_method;
27+
extern PGDLLIMPORT int sync_method;
2828

29-
extern XLogRecPtr ProcLastRecPtr;
30-
extern XLogRecPtr XactLastRecEnd;
29+
extern PGDLLIMPORT XLogRecPtr ProcLastRecPtr;
30+
extern PGDLLIMPORT XLogRecPtr XactLastRecEnd;
3131
extern PGDLLIMPORT XLogRecPtr XactLastCommitEnd;
3232

3333
/* these variables are GUC parameters related to XLOG */
34-
extern PGDLLIMPORT int wal_segment_size;
35-
extern int min_wal_size_mb;
36-
extern int max_wal_size_mb;
37-
extern int wal_keep_size_mb;
38-
extern int max_slot_wal_keep_size_mb;
39-
extern int XLOGbuffers;
40-
extern int XLogArchiveTimeout;
41-
extern int wal_retrieve_retry_interval;
42-
extern char *XLogArchiveCommand;
43-
extern bool EnableHotStandby;
44-
extern bool fullPageWrites;
45-
extern bool wal_log_hints;
46-
extern int wal_compression;
47-
extern bool wal_init_zero;
48-
extern bool wal_recycle;
49-
extern bool *wal_consistency_checking;
50-
extern char *wal_consistency_checking_string;
51-
extern bool log_checkpoints;
52-
extern bool track_wal_io_timing;
53-
extern int wal_decode_buffer_size;
54-
55-
extern int CheckPointSegments;
34+
extern PGDLLIMPORT int wal_segment_size;
35+
extern PGDLLIMPORT int min_wal_size_mb;
36+
extern PGDLLIMPORT int max_wal_size_mb;
37+
extern PGDLLIMPORT int wal_keep_size_mb;
38+
extern PGDLLIMPORT int max_slot_wal_keep_size_mb;
39+
extern PGDLLIMPORT int XLOGbuffers;
40+
extern PGDLLIMPORT int XLogArchiveTimeout;
41+
extern PGDLLIMPORT int wal_retrieve_retry_interval;
42+
extern PGDLLIMPORT char *XLogArchiveCommand;
43+
extern PGDLLIMPORT bool EnableHotStandby;
44+
extern PGDLLIMPORT bool fullPageWrites;
45+
extern PGDLLIMPORT bool wal_log_hints;
46+
extern PGDLLIMPORT int wal_compression;
47+
extern PGDLLIMPORT bool wal_init_zero;
48+
extern PGDLLIMPORT bool wal_recycle;
49+
extern PGDLLIMPORT bool *wal_consistency_checking;
50+
extern PGDLLIMPORT char *wal_consistency_checking_string;
51+
extern PGDLLIMPORT bool log_checkpoints;
52+
extern PGDLLIMPORT bool track_wal_io_timing;
53+
extern PGDLLIMPORT int wal_decode_buffer_size;
54+
55+
extern PGDLLIMPORT int CheckPointSegments;
5656

5757
/* Archive modes */
5858
typedef enum ArchiveMode
@@ -61,7 +61,7 @@ typedef enum ArchiveMode
6161
ARCHIVE_MODE_ON, /* enabled while server is running normally */
6262
ARCHIVE_MODE_ALWAYS /* enabled always (even during recovery) */
6363
} ArchiveMode;
64-
extern int XLogArchiveMode;
64+
extern PGDLLIMPORT int XLogArchiveMode;
6565

6666
/* WAL levels */
6767
typedef enum WalLevel
@@ -121,7 +121,7 @@ extern PGDLLIMPORT int wal_level;
121121
#define XLogLogicalInfoActive() (wal_level >= WAL_LEVEL_LOGICAL)
122122

123123
#ifdef WAL_DEBUG
124-
extern bool XLOG_DEBUG;
124+
extern PGDLLIMPORT bool XLOG_DEBUG;
125125
#endif
126126

127127
/*
@@ -175,7 +175,7 @@ typedef struct CheckpointStatsData
175175
* entire sync phase. */
176176
} CheckpointStatsData;
177177

178-
extern CheckpointStatsData CheckpointStats;
178+
extern PGDLLIMPORT CheckpointStatsData CheckpointStats;
179179

180180
/*
181181
* GetWALAvailability return codes

src/include/access/xlog_internal.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -358,9 +358,9 @@ extern void XLogRecGetBlockRefInfo(XLogReaderState *record, bool pretty,
358358
* Exported for the functions in timeline.c and xlogarchive.c. Only valid
359359
* in the startup process.
360360
*/
361-
extern bool ArchiveRecoveryRequested;
362-
extern bool InArchiveRecovery;
363-
extern bool StandbyMode;
364-
extern char *recoveryRestoreCommand;
361+
extern PGDLLIMPORT bool ArchiveRecoveryRequested;
362+
extern PGDLLIMPORT bool InArchiveRecovery;
363+
extern PGDLLIMPORT bool StandbyMode;
364+
extern PGDLLIMPORT char *recoveryRestoreCommand;
365365

366366
#endif /* XLOG_INTERNAL_H */

src/include/access/xlogprefetcher.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#include "access/xlogrecord.h"
1919

2020
/* GUCs */
21-
extern int recovery_prefetch;
21+
extern PGDLLIMPORT int recovery_prefetch;
2222

2323
/* Possible values for recovery_prefetch */
2424
typedef enum

src/include/access/xlogrecovery.h

+21-21
Original file line numberDiff line numberDiff line change
@@ -49,33 +49,33 @@ typedef enum RecoveryPauseState
4949
} RecoveryPauseState;
5050

5151
/* User-settable GUC parameters */
52-
extern bool recoveryTargetInclusive;
53-
extern int recoveryTargetAction;
54-
extern int recovery_min_apply_delay;
55-
extern char *PrimaryConnInfo;
56-
extern char *PrimarySlotName;
57-
extern char *recoveryRestoreCommand;
58-
extern char *recoveryEndCommand;
59-
extern char *archiveCleanupCommand;
52+
extern PGDLLIMPORT bool recoveryTargetInclusive;
53+
extern PGDLLIMPORT int recoveryTargetAction;
54+
extern PGDLLIMPORT int recovery_min_apply_delay;
55+
extern PGDLLIMPORT char *PrimaryConnInfo;
56+
extern PGDLLIMPORT char *PrimarySlotName;
57+
extern PGDLLIMPORT char *recoveryRestoreCommand;
58+
extern PGDLLIMPORT char *recoveryEndCommand;
59+
extern PGDLLIMPORT char *archiveCleanupCommand;
6060

6161
/* indirectly set via GUC system */
62-
extern TransactionId recoveryTargetXid;
63-
extern char *recovery_target_time_string;
64-
extern TimestampTz recoveryTargetTime;
65-
extern const char *recoveryTargetName;
66-
extern XLogRecPtr recoveryTargetLSN;
67-
extern RecoveryTargetType recoveryTarget;
68-
extern char *PromoteTriggerFile;
69-
extern bool wal_receiver_create_temp_slot;
70-
extern RecoveryTargetTimeLineGoal recoveryTargetTimeLineGoal;
71-
extern TimeLineID recoveryTargetTLIRequested;
72-
extern TimeLineID recoveryTargetTLI;
62+
extern PGDLLIMPORT TransactionId recoveryTargetXid;
63+
extern PGDLLIMPORT char *recovery_target_time_string;
64+
extern PGDLLIMPORT TimestampTz recoveryTargetTime;
65+
extern PGDLLIMPORT const char *recoveryTargetName;
66+
extern PGDLLIMPORT XLogRecPtr recoveryTargetLSN;
67+
extern PGDLLIMPORT RecoveryTargetType recoveryTarget;
68+
extern PGDLLIMPORT char *PromoteTriggerFile;
69+
extern PGDLLIMPORT bool wal_receiver_create_temp_slot;
70+
extern PGDLLIMPORT RecoveryTargetTimeLineGoal recoveryTargetTimeLineGoal;
71+
extern PGDLLIMPORT TimeLineID recoveryTargetTLIRequested;
72+
extern PGDLLIMPORT TimeLineID recoveryTargetTLI;
7373

7474
/* Have we already reached a consistent database state? */
75-
extern bool reachedConsistency;
75+
extern PGDLLIMPORT bool reachedConsistency;
7676

7777
/* Are we currently in standby mode? */
78-
extern bool StandbyMode;
78+
extern PGDLLIMPORT bool StandbyMode;
7979

8080
extern Size XLogRecoveryShmemSize(void);
8181
extern void XLogRecoveryShmemInit(void);

src/include/access/xlogutils.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
* potentially perform work during recovery should check RecoveryInProgress().
2222
* See XLogCtl notes in xlog.c.
2323
*/
24-
extern bool InRecovery;
24+
extern PGDLLIMPORT bool InRecovery;
2525

2626
/*
2727
* Like InRecovery, standbyState is only valid in the startup process.
@@ -52,7 +52,7 @@ typedef enum
5252
STANDBY_SNAPSHOT_READY
5353
} HotStandbyState;
5454

55-
extern HotStandbyState standbyState;
55+
extern PGDLLIMPORT HotStandbyState standbyState;
5656

5757
#define InHotStandby (standbyState >= STANDBY_SNAPSHOT_PENDING)
5858

src/include/bootstrap/bootstrap.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@
2727
#define BOOTCOL_NULL_FORCE_NULL 2
2828
#define BOOTCOL_NULL_FORCE_NOT_NULL 3
2929

30-
extern Relation boot_reldesc;
31-
extern Form_pg_attribute attrtypes[MAXATTR];
32-
extern int numattr;
30+
extern PGDLLIMPORT Relation boot_reldesc;
31+
extern PGDLLIMPORT Form_pg_attribute attrtypes[MAXATTR];
32+
extern PGDLLIMPORT int numattr;
3333

3434

3535
extern void BootstrapModeMain(int argc, char *argv[], bool check_only) pg_attribute_noreturn();

src/include/catalog/namespace.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ extern void AtEOSubXact_Namespace(bool isCommit, SubTransactionId mySubid,
182182
SubTransactionId parentSubid);
183183

184184
/* stuff for search_path GUC variable */
185-
extern char *namespace_search_path;
185+
extern PGDLLIMPORT char *namespace_search_path;
186186

187187
extern List *fetch_search_path(bool includeImplicit);
188188
extern int fetch_search_path_array(Oid *sarray, int sarray_len);

src/include/catalog/objectaddress.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ typedef struct ObjectAddress
2828
int32 objectSubId; /* Subitem within object (eg column), or 0 */
2929
} ObjectAddress;
3030

31-
extern const ObjectAddress InvalidObjectAddress;
31+
extern PGDLLIMPORT const ObjectAddress InvalidObjectAddress;
3232

3333
#define ObjectAddressSubSet(addr, class_id, object_id, object_sub_id) \
3434
do { \

src/include/catalog/storage.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
#include "utils/relcache.h"
2121

2222
/* GUC variables */
23-
extern int wal_skip_threshold;
23+
extern PGDLLIMPORT int wal_skip_threshold;
2424

2525
extern SMgrRelation RelationCreateStorage(RelFileNode rnode,
2626
char relpersistence,

src/include/commands/async.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
*/
2121
#define NUM_NOTIFY_BUFFERS 8
2222

23-
extern bool Trace_notify;
24-
extern volatile sig_atomic_t notifyInterruptPending;
23+
extern PGDLLIMPORT bool Trace_notify;
24+
extern PGDLLIMPORT volatile sig_atomic_t notifyInterruptPending;
2525

2626
extern Size AsyncShmemSize(void);
2727
extern void AsyncShmemInit(void);

src/include/commands/tablespace.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
#include "lib/stringinfo.h"
2020
#include "nodes/parsenodes.h"
2121

22-
extern bool allow_in_place_tablespaces;
22+
extern PGDLLIMPORT bool allow_in_place_tablespaces;
2323

2424
/* XLOG stuff */
2525
#define XLOG_TBLSPC_CREATE 0x00

src/include/commands/user.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#include "parser/parse_node.h"
1818

1919
/* GUC. Is actually of type PasswordType. */
20-
extern int Password_encryption;
20+
extern PGDLLIMPORT int Password_encryption;
2121

2222
/* Hook to check passwords in CreateRole() and AlterRole() */
2323
typedef void (*check_password_hook_type) (const char *username, const char *shadow_pass, PasswordType password_type, Datum validuntil_time, bool validuntil_null);

src/include/commands/vacuum.h

+9-9
Original file line numberDiff line numberDiff line change
@@ -252,17 +252,17 @@ typedef struct VacDeadItems
252252

253253
/* GUC parameters */
254254
extern PGDLLIMPORT int default_statistics_target; /* PGDLLIMPORT for PostGIS */
255-
extern int vacuum_freeze_min_age;
256-
extern int vacuum_freeze_table_age;
257-
extern int vacuum_multixact_freeze_min_age;
258-
extern int vacuum_multixact_freeze_table_age;
259-
extern int vacuum_failsafe_age;
260-
extern int vacuum_multixact_failsafe_age;
255+
extern PGDLLIMPORT int vacuum_freeze_min_age;
256+
extern PGDLLIMPORT int vacuum_freeze_table_age;
257+
extern PGDLLIMPORT int vacuum_multixact_freeze_min_age;
258+
extern PGDLLIMPORT int vacuum_multixact_freeze_table_age;
259+
extern PGDLLIMPORT int vacuum_failsafe_age;
260+
extern PGDLLIMPORT int vacuum_multixact_failsafe_age;
261261

262262
/* Variables for cost-based parallel vacuum */
263-
extern pg_atomic_uint32 *VacuumSharedCostBalance;
264-
extern pg_atomic_uint32 *VacuumActiveNWorkers;
265-
extern int VacuumCostBalanceLocal;
263+
extern PGDLLIMPORT pg_atomic_uint32 *VacuumSharedCostBalance;
264+
extern PGDLLIMPORT pg_atomic_uint32 *VacuumActiveNWorkers;
265+
extern PGDLLIMPORT int VacuumCostBalanceLocal;
266266

267267

268268
/* in commands/vacuum.c */

0 commit comments

Comments
 (0)