SPI-header-files safe for C++-compiler

Поиск
Список
Период
Сортировка
От Jacob Rief
Тема SPI-header-files safe for C++-compiler
Дата
Msg-id 1182984211.3620.43.camel@ruben
обсуждение исходный текст
Ответы Re: SPI-header-files safe for C++-compiler  (Neil Conway <neilc@samurai.com>)
Список pgsql-patches
This is a request I posted in February. The thread was named "Writing
triggers in C++". However I did not supply a patch then, and some people
misunderstood my problem. I will try to explain it again:

My problem is, I wrote some triggers in C using the SPI-API. Those
triggers call some functions defined in an external C++ library. In
order to use name-mangled functions, namespaces and C++-header-files,
provided by this library, I have to use a C++ compiler to compile my
trigger-functions. But the C++-compiler rejects to compile legal C code,
because some of the included Postgres-headers, ie. postgres.h,
executor/spi.h, commands/trigger.h, fmgr.h use a few C++ keywords to
defined a some struct members and function arguments. The incriminating
C++-keywords used in the Postgres-headers are: 'typeid', 'typename' and
'using'.

It would do no harm to the Postgres-sources if these keywords would be
replaced with a similar identifier. I wrote a patch which applies cleanly
onto version 8.2.4 (and 8.2.3) and keeps the Postgres binary compatible to
an unpatched version.

I would appreciate to see this patch applied onto the Postgres-sources.
Other authors using the SPI-API together with a C++-compiler would also
benefit from this patch.

Regards, Jacob

Вложения

В списке pgsql-patches по дате отправления:

Предыдущее
От: "Pavan Deolasee"
Дата:
Сообщение: HOT latest patch - version 8
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Load Distributed Checkpoints, final patch