compiling PL/pgSQL plugin with C++
Тарасов Георгий Витальевич <tarasov-g@gaz-is.ru>
From: Тарасов Георгий Витальевич <Tarasov-G@gaz-is.ru>
To: "pgsql-general@postgresql.org" <pgsql-general@postgresql.org>
Date: 2019-05-30T15:14:01Z
Lists: pgsql-hackers, pgsql-general
Attachments
- rename-args-looks-like-cpp-keywords.patch (application/octet-stream) patch
Dear all,
I'm working on development of some PL/pgSQL plugin.
The smaller part of my code is written on C.
It's a standard extension code for integration with fmgr (_PG_init ...)
But bigger part of the code is written on C++.
And here I need declarations of internal PL/pgSQL structs from plpgsql.h
Direct include of this file to my C++ code results in the following errors:
/opt/pgsql-11/include/server/plpgsql.h:1201:45: ошибка: expected <,> or <...> before <new>
extern void plpgsql_adddatum(PLpgSQL_datum *new);
^
/opt/pgsql-11/include/server/plpgsql.h:1228:15: ошибка: expected <,> or <...> before <typeid>
Oid *typeid, int32 *typmod, Oid *collation);
^
It's obviously that this code can't be compiled with C++ because the
C++ keywords are used as an identifiers. I modified plpgsql.h.
So, please advise does the renaming is the right step in this situation??
All my modifications are in the attached patch.
Corrections are made also in C-files (pl_comp.c and pl_exec.c), where the function definitions are
located, but this is not necessarily.
George
Commits
-
Improve coverage of cpluspluscheck.
- 6f54b80edd88 12.0 landed
-
Fix C++ incompatibilities in ecpg/preproc/ header files.
- 4f67858d3f21 12.0 landed
-
Fix C++ incompatibilities in plpgsql's header files.
- db5d99916e80 9.4.23 landed
- da53e4f93fb3 9.5.18 landed
- c332c94adb70 9.6.14 landed
- 683c17b3071f 10.9 landed
- 3f61b3205f1a 12.0 landed
- 312017fcc46b 11.4 landed
-
Fix assorted header files that failed to compile standalone.
- 7640f9312321 12.0 landed
-
Make our perfect hash functions be valid C++.
- 9e58705a7f97 12.0 landed