473,516 Members | 2,956 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3133
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
5688
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. ================================================================= Error 19: "CORBAManagerMessages.h", line 4 # Unexpected 'std'. using std::string; ^^^
3
2137
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 System.Collections;
3
2416
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 project classes with 'using' meaning
14
5734
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 SQL DATABASE, probably by the click of a button. Is this possible? & what is the BEST APPROACH for doing this? & also if any links are there do...
8
2396
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 into the bin directory but am not able to progress. Can anyone please guide me to an online tutorial on the subject. Thanks,
0
2181
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 .NET 2.0 DataProvider (iAnywhere.Data.AsaClient.dll) into the GAC so it can be used in the ProviderName property of a SQLDataSource and loads properly...
10
1932
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, CN) Dim DR As OleDbDataReader = CMD.ExecuteReader()
0
2537
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 link (1,2,3 so on). The code can be found in SubscriptionCart.aspx.cs. Default.aspx ------------
3
8211
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 build with these methods, will appear to encrypt and decrypt, but the resulting decrypted file will be corrupted. I tried encrypting a .bmp file and...
6
5122
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 application working. However, when attempting to implement the solution, the AJAX calls weren't updating the screen like the examples were and...
0
7276
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7408
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7581
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7548
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
4773
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3267
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3259
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1624
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
488
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.