Re: server-side extension in c++ - Mailing list pgsql-general

From Mark Cave-Ayland
Subject Re: server-side extension in c++
Date
Msg-id 4C0689A6.6070405@siriusit.co.uk
Whole thread Raw
In response to Re: server-side extension in c++  (David Fetter <david@fetter.org>)
Responses Re: server-side extension in c++
List pgsql-general
David Fetter wrote:

> Is PostGIS following these guidelines?

In short, no. Due to various problems in the early days with C++
exceptions generated by the GEOS library causing problems in C (and also
ABI changes forcing a recompile of any GEOS linked library), a thin
intermediate C++ layer called libgeos_c was added to GEOS.

For each public C++ function, libgeos_c declares a similarly-named
wrapper with extern "C" that just executes the underlying C++ function.
If an underlying error such as an exception occurs, the libgeos_c
wrapper returns false, and a simple handler allows the C caller to
retrieve the related error string.

While it does seem quite inelegant, I don't believe any problems linking
between C/C++ have been reported on any compiler/platform since this was
  put into place.


HTH,

Mark.

--
Mark Cave-Ayland - Senior Technical Architect
PostgreSQL - PostGIS
Sirius Corporation plc - control through freedom
http://www.siriusit.co.uk
t: +44 870 608 0063

Sirius Labs: http://www.siriusit.co.uk/labs

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: libreadline and Debian 5 - not missing just badly named
Next
From: Greg Smith
Date:
Subject: Re: create index concurrently - duplicate index to reduce time without an index