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

From: Jacob Rief <jacob(dot)rief(at)gmx(dot)at>
To: pgsql-patches(at)postgresql(dot)org
Subject: SPI-header-files safe for C++-compiler
Date: 2007-06-27 22:43:30
Message-ID: 1182984211.3620.43.camel@ruben
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Attachment Content-Type Size
postgresql-8.2.4-c++-safe.patch text/x-patch 52.0 KB

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2007-06-28 00:19:48 Re: Load Distributed Checkpoints, final patch
Previous Message Pavan Deolasee 2007-06-27 09:06:06 HOT latest patch - version 8