Re: Using C++ with CREATE FUNCTION - Mailing list pgsql-general

From Mike Mascari
Subject Re: Using C++ with CREATE FUNCTION
Date
Msg-id 3CFDAFDE.C844DC20@mascari.com
Whole thread Raw
In response to Using C++ with CREATE FUNCTION  (Mike Mascari <mascarm@mascari.com>)
List pgsql-general
I wrote:
>
> I'm having a bit of trouble getting a shared module written in C++ to
> load correctly with CREATE FUNCTION. The C source is:
>
> #include "postgres.h"
> #include <string.h>
> #include "fmgr.h"
>
> PG_FUNCTION_INFO_V1(echo);

...

> 1. Prevent name mangling by adding:
>
> extern "C" {
>   Datum echo(PG_FUNCTION_ARGS);
> };

Please ignore my post. The include directives must be within the extern
"C" block as well. I'm not sure what needs to be done - or if anything
should be - to allow "postgres.h" and "fmgr.h" to be __cplusplus aware,
but simply placing them within the extern "C" block solved all my
problems...

Mike Mascari
mascarm@mascari.com

pgsql-general by date:

Previous
From: Neil Conway
Date:
Subject: Re: Postgres 7.2.1 Really Spinning the CPU
Next
From: Martijn van Oosterhout
Date:
Subject: Re: View vs. Statement Query Plan