X-Original-To: pgsql-interfaces@postgresql.org Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 60651475A6D; Tue, 25 Feb 2003 16:02:27 -0500 (EST) Received: from postgresql.org ([64.49.215.8]) by localhost (postgresql.org [64.49.215.8:10024]) (amavisd-new) with SMTP id 86840-09; Tue, 25 Feb 2003 16:01:59 -0500 (EST) Received: from crtntx1-ar11-4-62-011-208.crtntx1.dsl-verizon.net (crtntx1-ar11-4-62-009-178.crtntx1.dsl-verizon.net [4.62.9.178]) by postgresql.org (Postfix) with ESMTP id 018DB475E1F; Tue, 25 Feb 2003 15:44:43 -0500 (EST) Received: from reliant.home.pri (reliant.home.pri [192.168.1.25]) by crtntx1-ar11-4-62-011-208.crtntx1.dsl-verizon.net (Postfix) with ESMTP id C2B4F3018; Tue, 25 Feb 2003 14:44:58 -0600 (CST) Subject: Re: ECPG and C++ compilation From: Matthew Vanecek To: Michael Meskes Cc: Postgresql Interfaces List In-Reply-To: <20030224152458.GA2980@feivel.fam-meskes.de> References: <1045926883.27169.76.camel@reliant.home.pri> <20030224152458.GA2980@feivel.fam-meskes.de> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-NZwFR0cfT0fTAlLhFSXc" Organization: Message-Id: <1046205884.12260.77.camel@reliant.home.pri> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.2 Date: 25 Feb 2003 14:44:45 -0600 X-Virus-Scanned: by amavisd-new X-Archive-Number: 200302/106 X-Sequence-Number: 3727 --=-NZwFR0cfT0fTAlLhFSXc Content-Type: text/plain Content-Transfer-Encoding: quoted-printable On Mon, 2003-02-24 at 09:24, Michael Meskes wrote: > On Sat, Feb 22, 2003 at 09:14:43AM -0600, Matthew Vanecek wrote: > > I don't think that will work. I can never get ecpg to recognize > > typedefed structs, even when declaring the typedefed struct within a > > DECLARE SECTION. >=20 > Now that I do not understand. What exactly doesn't work? do you have a > small example? >=20 #include EXEC SQL BEGIN DECLARE SECTION; struct s_somestruct { int id; char *field; }; typedef struct s_somestruct SomeStruct; EXEC SQL END DECLARE SECTION; int main(int argc, char **argv) { printf("this is just to show parse errors from ecpg\n"); return 0; } yields: me2v@reliant conn $ ecpg example.pgc=20 example.pgc:7: ERROR: parse error at or near ";" If instead I use: #include struct s_somestruct { int id; char *field; }; EXEC SQL BEGIN DECLARE SECTION; typedef struct s_somestruct SomeStruct; EXEC SQL END DECLARE SECTION; int main(int argc, char **argv) { printf("this is just to show parse errors from ecpg\n"); return 0; } I get: me2v@reliant conn $ ecpg example.pgc=20 example.pgc:9: ERROR: parse error at or near "SomeStruct" I get this error also if I use: EXEC SQL BEGIN DECLARE SECTION; struct s_somestruct { int id; char *field; } a_struct; typedef struct s_somestruct SomeStruct; EXEC SQL END DECLARE SECTION; Doing "typedef struct { /* stuff */ } AStruct;" appears to work with ecpg from 7.3.2, but IIRC, it would not work in 7.2.3. > > Probably doing the sizeof calculation within ecpg would be the proper > > way to go, and using that value in the ECPGdo call instead of > > sizeof(whatever). With respect to C++, anyhow. I'm sure the developers >=20 > But that would mean you cannot precompile on one machine for usage on > another. Right? >=20 Is sizeof() a compile-time execution/calculation? If so, then it would definitely not be portable, unless you implemented/used a generic types library (such as glib, for example). Since it works in C, though, and ECPG generates C, I'm by no means making a suggestion to follow this path. ;) --=20 Matthew Vanecek perl -e 'print $i=3Dpack(c5,(41*2),sqrt(7056),(unpack(c,H)-2),oct(115),10);' ***************************************************************************= ***** For 93 million miles, there is nothing between the sun and my shadow except= me. I'm always getting in the way of something... --=-NZwFR0cfT0fTAlLhFSXc Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (GNU/Linux) Comment: For info see http://www.gnupg.org iD8DBQA+W9W8i/CNzDSN0RIRAocIAJ9oUrrXOQZjQvdER4NWp1/SS3k52QCgntMU XeE5RHAkNcNided5U/JMFhQ= =IaTP -----END PGP SIGNATURE----- --=-NZwFR0cfT0fTAlLhFSXc--