Re: C++ User-defined functions

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Craig Ringer <craig(at)postnewspapers(dot)com(dot)au>
Cc: George Oakman <oakmang(at)hotmail(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: C++ User-defined functions
Date: 2009-03-09 18:17:04
Message-ID: 9684.1236622624@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Craig Ringer <craig(at)postnewspapers(dot)com(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message George Oakman 2009-03-09 19:22:11 Re: C++ User-defined functions
Previous Message Ivan Sergio Borgonovo 2009-03-09 18:10:47 in role, ownership and permissions was: grant everything on everything and then revoke