compiling PL/pgSQL plugin with C++

From: Тарасов Георгий Витальевич <Tarasov-G(at)gaz-is(dot)ru>
To: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: compiling PL/pgSQL plugin with C++
Date: 2019-05-30 15:14:01
Message-ID: b517ec3918d645eb950505eac8dd434e@gaz-is.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

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

Attachment Content-Type Size
rename-args-looks-like-cpp-keywords.patch application/octet-stream 3.6 KB

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2019-05-30 15:54:24 Re: compiling PL/pgSQL plugin with C++
Previous Message Peter J. Holzer 2019-05-30 10:38:47 Migrating a Patroni cluster from Ubuntu 16.04 to Ubuntu 18.04

Browse pgsql-hackers by date

  From Date Subject
Next Message Magnus Hagander 2019-05-30 15:39:23 New committer: David Rowley
Previous Message Tomas Vondra 2019-05-30 15:10:29 Re: error messages in extended statistics