doc PG 17 relnotes: add FETCH_COUNT item
[pgsql.git] / src / common / link-canary.c
blob5b2d0fc8854f0dc495e611e0911b39a8ec7119de
1 /*-------------------------------------------------------------------------
2 * link-canary.c
3 * Detect whether src/common functions came from frontend or backend.
5 * Copyright (c) 2018-2024, PostgreSQL Global Development Group
7 * IDENTIFICATION
8 * src/common/link-canary.c
10 *-------------------------------------------------------------------------
12 #include "c.h"
14 #include "common/link-canary.h"
17 * This function just reports whether this file was compiled for frontend
18 * or backend environment. We need this because in some systems, mainly
19 * ELF-based platforms, it is possible for a shlib (such as libpq) loaded
20 * into the backend to call a backend function named XYZ in preference to
21 * the shlib's own function XYZ. That's bad if the two functions don't
22 * act identically. This exact situation comes up for many functions in
23 * src/common and src/port, where the same function names exist in both
24 * libpq and the backend but they don't act quite identically. To verify
25 * that appropriate measures have been taken to prevent incorrect symbol
26 * resolution, libpq should test that this function returns true.
28 bool
29 pg_link_canary_is_frontend(void)
31 #ifdef FRONTEND
32 return true;
33 #else
34 return false;
35 #endif