Re: PostgreSQL C Language Extension with C++ Code

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: TalGloz <glozmantal(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: PostgreSQL C Language Extension with C++ Code
Date: 2018-08-12 19:12:14
Message-ID: 1607.1534101134@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

TalGloz <glozmantal(at)gmail(dot)com> writes:
> But now my compiler throws some other errors when running make:

> myfunc.cpp:29:10: error: conflicting declaration of C function ‘int64_t
> sum_of_numbers()’
> int64_t sum_of_numbers(){
> ^~~~~~~~~~~~~~

Well, yeah, you forgot to repeat the argument list here. For that
matter, spelling Datum as int64_t is a recipe for trouble, even if
it works on some particular platform. Should be

Datum sum_of_numbers(PG_FUNCTION_ARGS) { ...

> Why is it so hard to use C++ with PostgerSQL for a C extension? :)

Probably because you've failed to break your bad C++ habits.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Phil Endecott 2018-08-12 19:25:38 Re: Replication failure, slave requesting old segments
Previous Message Phil Endecott 2018-08-12 19:09:32 Re: Replication failure, slave requesting old segments