Re: Linking PostgreSQL as a C++ program

From: Craig Ringer <craig(at)2ndquadrant(dot)com>
To: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Linking PostgreSQL as a C++ program
Date: 2018-01-29 05:03:55
Message-ID: CAMsr+YG2DQLiP4EmjXHPhRTBOgXm5neK9ErzcxmtsGFaaVT1Qg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 29 January 2018 at 18:02, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
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"
> #ifdef __cplusplus
> }
> #endif

For headers used by both C and C++ code, yes.

For C++ sources, no.

--
Craig Ringer http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Yuto Hayamizu 2018-01-29 05:12:32 Re: [HACKERS] [PATCH] Overestimated filter cost and its mitigation
Previous Message Masahiko Sawada 2018-01-29 05:03:02 Re: Temporary tables prevent autovacuum, leading to XID wraparound