Re: Using C++ with CREATE FUNCTION

From: Mike Mascari <mascarm(at)mascari(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Using C++ with CREATE FUNCTION
Date: 2002-06-05 06:29:50
Message-ID: 3CFDAFDE.C844DC20@mascari.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)mascari(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Martijn van Oosterhout 2002-06-05 08:47:16 Re: View vs. Statement Query Plan
Previous Message Neil Conway 2002-06-05 06:09:11 Re: Postgres 7.2.1 Really Spinning the CPU