PostgreSQL Source Code
git master
Loading...
Searching...
No Matches
test_cplusplusext.cpp
Go to the documentation of this file.
1
/*--------------------------------------------------------------------------
2
*
3
* test_cplusplusext.cpp
4
* Test that PostgreSQL headers compile with a C++ compiler.
5
*
6
* This file is compiled with a C++ compiler to verify that PostgreSQL
7
* headers remain compatible with C++ extensions.
8
*
9
* Copyright (c) 2025-2026, PostgreSQL Global Development Group
10
*
11
* IDENTIFICATION
12
* src/test/modules/test_cplusplusext/test_cplusplusext.cpp
13
*
14
* -------------------------------------------------------------------------
15
*/
16
17
extern
"C"
{
18
#include "
postgres.h
"
19
#include "
fmgr.h
"
20
21
PG_MODULE_MAGIC
;
22
23
PG_FUNCTION_INFO_V1
(
test_cplusplus_add
);
24
}
25
26
/*
27
* Simple function that returns the sum of two integers. This verifies that
28
* C++ extension modules can be loaded and called correctly at runtime.
29
*/
30
extern
"C"
Datum
31
test_cplusplus_add
(
PG_FUNCTION_ARGS
)
32
{
33
int32
a
=
PG_GETARG_INT32
(0);
34
int32
b
=
PG_GETARG_INT32
(1);
35
36
PG_RETURN_INT32
(
a
+
b
);
37
}
int32
int32_t int32
Definition
c.h:542
fmgr.h
PG_FUNCTION_INFO_V1
#define PG_FUNCTION_INFO_V1(funcname)
Definition
fmgr.h:417
PG_RETURN_INT32
#define PG_RETURN_INT32(x)
Definition
fmgr.h:355
PG_GETARG_INT32
#define PG_GETARG_INT32(n)
Definition
fmgr.h:269
PG_FUNCTION_ARGS
#define PG_FUNCTION_ARGS
Definition
fmgr.h:193
b
int b
Definition
isn.c:74
a
int a
Definition
isn.c:73
postgres.h
Datum
uint64_t Datum
Definition
postgres.h:70
PG_MODULE_MAGIC
PG_MODULE_MAGIC
Definition
test_cplusplusext.cpp:21
test_cplusplus_add
Datum test_cplusplus_add(PG_FUNCTION_ARGS)
Definition
test_cplusplusext.cpp:31
src
test
modules
test_cplusplusext
test_cplusplusext.cpp
Generated on Thu Jan 29 2026 06:13:18 for PostgreSQL Source Code by
1.9.8