By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,302 Members | 1,163 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,302 IT Pros & Developers. It's quick & easy.

Using C++ With SPI?

P: n/a
I had been having good luck writing stored procs in C++ with Postgres.
But, today, I needed to include the SPI interface to help a trigger
along, aka

#include "executor/spi.h"

and this is completely ungrokable by GNU C++.

Am I stuck, or can I solve this problem (tried extern "C" {}, no go).

Thanks.

cwl
Nov 11 '05 #1
Share this Question
Share on Google+
2 Replies

P: n/a
Clay Luther <cl*****@cisco.com> writes:
I had been having good luck writing stored procs in C++ with Postgres.
But, today, I needed to include the SPI interface to help a trigger
along, aka

#include "executor/spi.h"

and this is completely ungrokable by GNU C++.

Am I stuck, or can I solve this problem (tried extern "C" {}, no go).


You'll definitely need 'extern "C" {}' around that include.

Why don't you try that again and actually post an error message so
people can try and help you?

-Doug

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to ma*******@postgresql.org so that your
message can get through to the mailing list cleanly

Nov 11 '05 #2

P: n/a
Pffft. I figured it was obvious.
#include "postgres.h"
#include "fmgr.h"
extern "C"
{
#include "executor/spi.h"
#include "commands/trigger.h"
};

int main(int argc, char* argv[])
{
return 0;
}

g++ -g -Wall -g -I/usr/include/pgsql/server -c practice.cpp
In file included from /usr/include/pgsql/server/executor/spi.h:22,
from practice.cpp:15:
/usr/include/pgsql/server/nodes/primnodes.h:568: parse error before
`using'
In file included from /usr/include/pgsql/server/nodes/relation.h:18,
from /usr/include/pgsql/server/executor/spi.h:23,
from practice.cpp:15:
/usr/include/pgsql/server/nodes/parsenodes.h:131: declaration does not
declare
anything
/usr/include/pgsql/server/nodes/parsenodes.h:131: parse error before
`typeid'
/usr/include/pgsql/server/nodes/parsenodes.h:184: parse error before
`typename'
/usr/include/pgsql/server/nodes/parsenodes.h:200: parse error before
`typename'
/usr/include/pgsql/server/nodes/parsenodes.h:314: parse error before
`typename'
/usr/include/pgsql/server/nodes/parsenodes.h:1146: parse error before
`typename
'
In file included from /usr/include/pgsql/server/utils/portal.h:23,
from /usr/include/pgsql/server/tcop/pquery.h:18,
from /usr/include/pgsql/server/executor/spi.h:28,
from practice.cpp:15:
/usr/include/pgsql/server/nodes/memnodes.h:44: parse error before
`delete'
In file included from /usr/include/pgsql/server/executor/spi.h:36,
from practice.cpp:15:
/usr/include/pgsql/server/utils/builtins.h:414: parse error before
`namespace'
make: *** [practice.o] Error 1


On Wed, 2003-07-02 at 15:17, Doug McNaught wrote:
Clay Luther <cl*****@cisco.com> writes:
I had been having good luck writing stored procs in C++ with

Postgres.
But, today, I needed to include the SPI interface to help a trigger
along, aka

#include "executor/spi.h"

and this is completely ungrokable by GNU C++.

Am I stuck, or can I solve this problem (tried extern "C" {}, no

go).

You'll definitely need 'extern "C" {}' around that include.

Why don't you try that again and actually post an error message so
people can try and help you?

-Doug


Nov 11 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.