Re: Can I use extern "C" in an extension so I can use C++?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Isaac Morland <isaac(dot)morland(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Can I use extern "C" in an extension so I can use C++?
Date: 2020-07-05 22:49:56
Message-ID: 1315608.1593989396@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Isaac Morland <isaac(dot)morland(at)gmail(dot)com> writes:
> On Sun, 5 Jul 2020 at 18:07, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> Something like the attached works for me; what problem are you having
>> *exactly*?

> I've attached a .cpp file.

My example wrapped the Postgres #include's, the PG_MODULE_MAGIC call,
and the PG_FUNCTION_INFO_V1 call(s) in extern "C" { ... }. I'm pretty
sure you need to do all three of those things to get a working result
without mangled external function names.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Geoghegan 2020-07-05 23:47:40 Re: Default setting for enable_hashagg_disk (hash_mem)
Previous Message Isaac Morland 2020-07-05 22:41:47 Re: Can I use extern "C" in an extension so I can use C++?