Thread: C++ and SPI

C++ and SPI

From
"Andrij Korud"
Date:
Hi,
I'm trying to compile SPI function written on C++.
Compile fail on using C++ keywords (typeid, typename) in header files. 
Wrapping #include in extern "C" {} don't help.
Here is output of the compiler:


++ -I/home/akorud/develop/postgresql-6.5.3/src/include
-I/usr/local/pgsql/include -traditional -o dialup.o -c dialup.cpp
In file included from
/home/akorud/develop/postgresql-6.5.3/src/include/nodes/relation.h:16,                from
/home/akorud/develop/postgresql-6.5.3/src/include/executor/spi.h:14,                from dialup.cpp:4:
/home/akorud/develop/postgresql-6.5.3/src/include/nodes/parsenodes.h:698:
parse error before `typename'
/home/akorud/develop/postgresql-6.5.3/src/include/nodes/parsenodes.h:738:
parse error before `typename'
/home/akorud/develop/postgresql-6.5.3/src/include/nodes/parsenodes.h:770:
parse error before `typename'
/home/akorud/develop/postgresql-6.5.3/src/include/nodes/parsenodes.h:874:
parse error before `;'
/home/akorud/develop/postgresql-6.5.3/src/include/nodes/parsenodes.h:875:
parse error before `typename'
In file included from
/home/akorud/develop/postgresql-6.5.3/src/include/utils/rel.h:17,                from
/home/akorud/develop/postgresql-6.5.3/src/include/access/relscan.h:17,                from
/home/akorud/develop/postgresql-6.5.3/src/include/nodes/execnodes.h:19,                from
/home/akorud/develop/postgresql-6.5.3/src/include/executor/spi.h:15,                from dialup.cpp:4:
/home/akorud/develop/postgresql-6.5.3/src/include/access/tupdesc.h:74:
parse error before `typeid'


Any suggestions?

Thanks in advance, 
Andriy Korud, Lviv, Ukraine.