Re: Can I use extern "C" in an extension so I can use C++? - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Can I use extern "C" in an extension so I can use C++?
Date
Msg-id 1315608.1593989396@sss.pgh.pa.us
Whole thread Raw
In response to Re: Can I use extern "C" in an extension so I can use C++?  (Isaac Morland <isaac.morland@gmail.com>)
Responses Re: Can I use extern "C" in an extension so I can use C++?  (Isaac Morland <isaac.morland@gmail.com>)
List pgsql-hackers
Isaac Morland <isaac.morland@gmail.com> writes:
> On Sun, 5 Jul 2020 at 18:07, Tom Lane <tgl@sss.pgh.pa.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



pgsql-hackers by date:

Previous
From: Isaac Morland
Date:
Subject: Re: Can I use extern "C" in an extension so I can use C++?
Next
From: Peter Geoghegan
Date:
Subject: Re: Default setting for enable_hashagg_disk (hash_mem)