Re: server-side extension in c++

From: David Fetter <david(at)fetter(dot)org>
To: Craig Ringer <craig(at)postnewspapers(dot)com(dot)au>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Bruce Momjian <bruce(at)momjian(dot)us>, Igor <igor(at)carcass(dot)ath(dot)cx>, pgsql-general(at)postgresql(dot)org
Subject: Re: server-side extension in c++
Date: 2010-06-01 12:52:46
Message-ID: 20100601125246.GA8539@fetter.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, Jun 01, 2010 at 02:13:02PM +0800, Craig Ringer wrote:
> On 01/06/10 11:05, Tom Lane wrote:
> > Bruce Momjian <bruce(at)momjian(dot)us> writes:
> >> Tom Lane wrote:
> >>> Personally I would reduce this section to
> >>> Don't.
> >
> >> Well, I would have avoided this mine-trap except we have this 9.0
> >> release note item:
> >> Allow use of <productname>C++</> functions in backend code (Kurt
> >> Harriman, Peter Eisentraut)
> >
> > I'd be interested to see a section like this written by someone
> > who'd actually done a nontrivial C++ extension and lived to tell
> > the tale.
>
> I can't speak up there - my own C++/Pg backend stuff has been fairly
> trivial, and has been where I can maintain a fairly clean separation
> of the C++-exposed and the Pg-backend-exposed parts. I was able to
> keep things separate enough that my C++ compilation units didn't
> include the Pg backend headers; they just exposed a pure C public
> interface. The Pg backend-using compilation units were written in C,
> and talked to the C++ part over its exposed pure C interfaces.
>
> This was very much pain-free, but I certainly wouldn't want to try
> to use C++ code tightly intermixed with Pg backend-using code. It'd
> be a nightmare.

These two paragraphs, suitably changed to be more like the rest of the
docs, would be a great start for people interested in using C++.

Would some short bits of sample code help?

Cheers,
David.
--
David Fetter <david(at)fetter(dot)org> http://fetter.org/
Phone: +1 415 235 3778 AIM: dfetter666 Yahoo!: dfetter
Skype: davidfetter XMPP: david(dot)fetter(at)gmail(dot)com
iCal: webcal://www.tripit.com/feed/ical/people/david74/tripit.ics

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate

In response to

Browse pgsql-general by date

  From Date Subject
Next Message David Fetter 2010-06-01 13:07:16 Re: Write-able CTEs, Update-able views, Hierarchical data, and optimistic locking
Previous Message Sim Zacks 2010-06-01 11:26:30 Re: plpythonu / using pg as an application server