Writing functions in C++

It is a bad idea to mix PostgreSQL with C++ for a number of reasons. It is better to wrap your C++ code into C code behind extern C functions. This can be a problem if you heavily use templates and libraries like boost.

For more discussion on use of C++ read the PostgreSQL documentation here http://www.postgresql.org/docs/current/static/xfunc-c.html#EXTEND-CPP.

Get PostgreSQL Server Programming - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.