Re: Linking PostgreSQL as a C++ program

2018-01-28 Thread Craig Ringer
On 29 January 2018 at 18:02, Michael Paquier wrote: > On Mon, Jan 29, 2018 at 05:46:54PM +1300, Craig Ringer wrote: > > extern "C" { > > #include "postgres.h" > > } > > Don't you need __cplusplus as well? More or less that: > > #ifdef __cplusplus > extern "C" { > #endif > #include "postgres.h" >

Re: Linking PostgreSQL as a C++ program

2018-01-28 Thread Michael Paquier
On Mon, Jan 29, 2018 at 05:46:54PM +1300, Craig Ringer wrote: > extern "C" { > #include "postgres.h" > } Don't you need __cplusplus as well? More or less that: #ifdef __cplusplus extern "C" { #endif #include "postgres.h" #ifdef __cplusplus } #endif -- Michael signature.asc Description: PGP sign

Linking PostgreSQL as a C++ program

2018-01-28 Thread Craig Ringer
Hi all In my ongoing efforts to make Tom look at me in horror, I've compiled PostgreSQL with C++ objects linked into the core server. Currently this is just my notes on how, in case anyone else needs to later. To do it you really only have to change src/backend/Makefile to use g++ as a linker: