Re: Help w/ Pro*C 1.3

From: Mark Hessling <mark_at_snark.itc.gu.edu.au>
Date: 7 Jul 93 22:04:34 GMT
Message-ID: <mark.742082674_at_snark>


chadb_at_NeoSoft.com (Chad A Brockman) writes:

>Is it not possible to use some type of define statement for use
>in arrays?? Here is my example that fails to precompile.
 

>#define ARRAYSZ 50
 

>EXEC SQL BEGIN DECLARE SECTION;
 
> char pumper_50[ARRAYSZ][5];
 

>EXEC SQL END DECLARE SECTION;
 
>This fails with a "was expecting unsigned_int ....." etc. etc.

This is one of the commonest "problems" with Pro*C and one of the most obvious once it is explained.

#define is a C preprocessor directive

As the order in which a Pro*C program is built is:

pcc   - Pro*C preprocess
cpp   - C preprocess (as part of cc)
cc    - C compile/link

then the resolution of #defines is not done until after the Pro*C preprocessor; hence the error. pcc is NOT a C preprocessor, it only handles the EXEC SQL code.

It is possible to achieve what you want by running the Pro*C program through cpp before pcc, but there are problems with definitions like NULL, etc. which means it may not be worth the hassle.

Cheers, Mark


Mark Hessling                         Email: M.Hessling_at_gu.edu.au
DBA,ITS                               Phone: +617 875 7691
Griffith University                   Fax:   +617 875 5314
Nathan, Brisbane QLD 4111             ***** PDCurses Maintainer *****
Australia                             *** Author of THE and GUROO ***
------------------------------------------------------------------------
Received on Thu Jul 08 1993 - 00:04:34 CEST

Original text of this message