473,241 Members | 1,780 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,241 software developers and data experts.

Using C++ With SPI?

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
2 3117
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Enos Meroka | last post by:
Hallo, I am a student doing my project in the university.. I have been trying to compile the program using HP -UX aCC compiler, however I keep on getting the following errors. ...
3
by: Mike L | last post by:
Should the command call "using" be before or after my namespace? **AFTER** namespace DataGridBrowser { using System; using System.Drawing; using System.Drawing.Drawing2D; using...
3
by: xzzy | last post by:
I was wondering why we have to have using System.Data using System.Configuration using etc.... why are they not all lumped into one 'using'? In other words, is there a best way to use...
14
by: pmud | last post by:
Hi, I need to use an Excel Sheet in ASP.NET application so that the users can enter (copy, paste ) large number of rows in this Excel Sheet. Also, Whatever the USER ENETRS needs to go to the...
8
by: acb | last post by:
Hi, I wrote a DLL Component (using Visual Studio 2005) and managed to include it into a C# Console application. I am now trying to include this component into a Web project. I copy the DLL...
0
by: Metal2You | last post by:
I'm working on an ASP.NET 2.0 application in Visual Studio 2005 that accesses a Sybase database back end. We're using Sybase SQL Anywhere 9.0.2.3228. I have installed and registered the Sybase...
10
by: mg | last post by:
I'm migrating from VB6 and have a question about using 'Using' and the best way to use it. Here is a example of a small bit of code: dbConx("open") Using CN Dim CMD As New OleDbCommand(sSQL,...
0
by: Eugene Anthony | last post by:
The problem with my coding is that despite removing the records stored in the array list, the rptPages repeater control is still visible. The rptPages repeater control displayes the navigation...
3
by: JDeats | last post by:
I have some .NET 1.1 code that utilizes this technique for encrypting and decrypting a file. http://support.microsoft.com/kb/307010 In .NET 2.0 this approach is not fully supported (a .NET 2.0...
6
by: =?Utf-8?B?U2hhd24gU2VzbmE=?= | last post by:
Greetings! I was researching AJAX to provide a solution to displaying status messages while a long process executed. I found several examples online and was able to use their code to get a quick...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.