Re: C++ User-defined functions - Mailing list pgsql-general

From Tom Lane
Subject Re: C++ User-defined functions
Date
Msg-id 9684.1236622624@sss.pgh.pa.us
Whole thread Raw
In response to Re: C++ User-defined functions  (Craig Ringer <craig@postnewspapers.com.au>)
Responses Re: C++ User-defined functions  (Craig Ringer <craig@postnewspapers.com.au>)
List pgsql-general
Craig Ringer <craig@postnewspapers.com.au> writes:
> There's lots more information about this on the Internet. Just look for
> generic resources on calling C from C++ and vice versa.

> (I don't *think* there are any issues with libstdc++, though you'd
> probably have to make sure that no other program linked into Pg brings
> in a different version of libstdc++.)

I believe this is fairly platform-dependent.  On platforms where the
standard libc includes everything you need for C++, you'd likely be okay,
but we've seen problems on (possibly obsolete?) platforms where it
doesn't.  One thing you've got to be really wary of is C++ exceptions,
which tend not to interoperate nicely with PG's longjmp-based error
handling.

My own advice is to think twice about how badly your function needs to
be C++ rather than plain C.

            regards, tom lane

pgsql-general by date:

Previous
From: Ivan Sergio Borgonovo
Date:
Subject: in role, ownership and permissions was: grant everything on everything and then revoke
Next
From: George Oakman
Date:
Subject: Re: C++ User-defined functions