Thread: C++ and using C functions

C++ and using C functions

From
Czuczy Gergely
Date:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

hello

i've tried to write a stored function in C++, using the libpq library, but
the g++(3.3.1) was unable to pass through the headers. there are a lot's
of reserved words used in structs as member names, such as delete,using,
namespace, and so on.

i'm using pgsql 7.3.4.
how can I fix it? i think so, i should modify the header files, i've tried
to put it into an ``extern "C" {...}'' block, but i didn't solve anything.

any ideas?

Bye,

Gergely Czuczy
mailto: phoemix@harmless.hu
PGP pubkey: http://phoemix.harmless.hu/phoemix.pgp
iRCNet: #demoscene   ICQ: 8067175

The point is, that geeks are not necessarily the outcasts
society often believes they are. The fact is that society
isn't cool enough to be included in our activities.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE/VKBDbBsEN0U7BV0RAkJPAKCg2/0JJEy+hhV7r3zcBAgYbWFRWQCg83/X
kj5EXUhpsIiObE5DOn/jsgc=
=H3YA
-----END PGP SIGNATURE-----




Re: C++ and using C functions

From
"Shridhar Daithankar"
Date:
On 2 Sep 2003 at 15:50, Czuczy Gergely wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> i'm using pgsql 7.3.4.
> how can I fix it? i think so, i should modify the header files, i've tried
> to put it into an ``extern "C" {...}'' block, but i didn't solve anything.

Try putting extern C, around include statements for libpq headers.
HTH

ByeShridhar

--
Fresco's Discovery:    If you knew what you were doing you'd probably be bored.



Re: C++ and using C functions

From
Czuczy Gergely
Date:
hello

as i said, i've tried to put into into an extern "C" statement, but it
didn't solve anything

Bye,

Gergely Czuczy
mailto: phoemix@harmless.hu
PGP pubkey: http://phoemix.harmless.hu/phoemix.pgp
iRCNet: #demoscene   ICQ: 8067175

The point is, that geeks are not necessarily the outcasts
society often believes they are. The fact is that society
isn't cool enough to be included in our activities.

On Tue, 2 Sep 2003, Shridhar Daithankar wrote:

> On 2 Sep 2003 at 15:50, Czuczy Gergely wrote:
>
> > -----BEGIN PGP SIGNED MESSAGE-----
> > i'm using pgsql 7.3.4.
> > how can I fix it? i think so, i should modify the header files, i've tried
> > to put it into an ``extern "C" {...}'' block, but i didn't solve anything.
>
> Try putting extern C, around include statements for libpq headers.
>
>  HTH
>
> Bye
>  Shridhar
>
> --
> Fresco's Discovery:    If you knew what you were doing you'd probably be bored.
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
>       subscribe-nomail command to majordomo@postgresql.org so that your
>       message can get through to the mailing list cleanly
>



Re: C++ and using C functions

From
Andreas Pflug
Date:
Czuczy Gergely wrote:

>-----BEGIN PGP SIGNED MESSAGE-----
>Hash: SHA1
>
>hello
>
>i've tried to write a stored function in C++, using the libpq library, but
>the g++(3.3.1) was unable to pass through the headers. there are a lot's
>of reserved words used in structs as member names, such as delete,using,
>namespace, and so on.
>
>i'm using pgsql 7.3.4.
>how can I fix it? i think so, i should modify the header files, i've tried
>to put it into an ``extern "C" {...}'' block, but i didn't solve anything.
>
>any ideas?
>
>Bye,
>
>Gergely Czuczy
>mailto: phoemix@harmless.hu
>PGP pubkey: http://phoemix.harmless.hu/phoemix.pgp
>iRCNet: #demoscene   ICQ: 8067175
>
>The point is, that geeks are not necessarily the outcasts
>society often believes they are. The fact is that society
>isn't cool enough to be included in our activities.
>-----BEGIN PGP SIGNATURE-----
>Version: GnuPG v1.0.6 (GNU/Linux)
>Comment: For info see http://www.gnupg.org
>
>iD8DBQE/VKBDbBsEN0U7BV0RAkJPAKCg2/0JJEy+hhV7r3zcBAgYbWFRWQCg83/X
>kj5EXUhpsIiObE5DOn/jsgc=
>=H3YA
>-----END PGP SIGNATURE-----
>
>  
>
You need to redefine several reserved names before may include 
postgresql headers. This is an extract what I needed:

#define using __using
#define typeid __typeid
#define typename __typename
#define namespace __namespace
#define delete __delete
extern "C"
{
#include "postgres.h"
#include "executor/spi.h"
#include "funcapi.h"
}
#undef using
#undef typeid
#undef typename
#undef namespace
#undef delete

Regards,
Andreas



Re: C++ and using C functions

From
Vince Vielhaber
Date:
On Tue, 2 Sep 2003, Shridhar Daithankar wrote:

> On 2 Sep 2003 at 15:50, Czuczy Gergely wrote:
>
> > -----BEGIN PGP SIGNED MESSAGE-----
> > i'm using pgsql 7.3.4.
> > how can I fix it? i think so, i should modify the header files, i've tried
> > to put it into an ``extern "C" {...}'' block, but i didn't solve anything.
>
> Try putting extern C, around include statements for libpq headers.

Is libpq++ gone?

Vince.
-- Fast, inexpensive internet service 56k and beyond!  http://www.pop4.net/  http://www.meanstreamradio.com
http://www.unknown-artists.com       Internet radio: It's not file sharing, it's just radio.
 



Re: C++ and using C functions

From
"Mendola Gaetano"
Date:
"Vince Vielhaber" <vev@michvhf.com> wrote:
> On Tue, 2 Sep 2003, Shridhar Daithankar wrote:
>
> > On 2 Sep 2003 at 15:50, Czuczy Gergely wrote:
> >
> > > -----BEGIN PGP SIGNED MESSAGE-----
> > > i'm using pgsql 7.3.4.
> > > how can I fix it? i think so, i should modify the header files, i've
tried
> > > to put it into an ``extern "C" {...}'' block, but i didn't solve
anything.
> >
> > Try putting extern C, around include statements for libpq headers.
>
> Is libpq++ gone?

No is still there and is working great but the OP need to write a
SP in C++.

Regards
Gaetano Mendola