Re: Is it possible to compile Pro*C and C++ code together using C++ compilser?

From: Wayne Hoferkamp <wayne_at_prcd.prc.mrms.navy.mil>
Date: 23 Feb 1995 20:39:22 GMT
Message-ID: <3iirpq$81n_at_monroe-emh4.army.mil>


In article <3hmu4v$ilc_at_news.kreonet.re.kr>, Park Min Seok <msPark_at_hdss.hsr.re.kr> says:
>
>Dear members,
>
>I want to know if it is possible to compile the source code in which
>Pro*C (or Oracle Call Interface code) and C++ code are reside together.
>
>Anyone who know something about this, Please let me know yours.
>
>Thanks.
>
>Park, Min-Seok
>Software R&D center, Hyundai Electronics Industries Co., Ltd.
>Seoul, Korea
>
>msPark_at_hdss.hsr.re.kr
>

We have just started developing code using PRO*C and GNU C++ 2.6.3. No major problems so far. I had to write an awk script to massage the output of the PRO*C precompiler so that C++ would compile it cleanly. I changed the following in the proc.mk makefile:

CC=g++
CFLAGS=-I. -O PROFLAGS=ireclen=132 oreclen=132 select_error=no $(SQLCHECK) $(PROUSER) \

        mode=ansi code=ansi_c sqlcheck=semantics userid=p6/p6 ltype=none

.pc.c:

        $(PROC) $(PROFLAGS) iname=$*.pc || (rm $*.c; exit 1)
        mv $*.c $*.c.tmp
        awk -f proc.awk $*.c.tmp > $*.c
        rm -f $*.c.tmp

.pc:
        $(PROC) iname=$*.pc $(PROFLAGS) || (rm $*.c; exit 1)
        mv $*.c $*.c.tmp
        awk -f proc.awk $*.c.tmp > $*.c
        rm -f $*.c.tmp
        _at_$(ECHO) $(CC) $(CFLAGS) $(LDFLAGS) -o $* $*.c $(PROLDLIBS)


and the proc.awk script looks like:

BEGIN {

      print "extern \"C\" void sqlglm(char*, int*, int*);"
      }
 

{

sub(/^extern void sql/, "extern \"C\" void sql")
sub(/^static const short sqlcud0/, "static short sqlcud0")
sub(/^static const struct sqlcxp sqlfpn/, "static struct sqlcxp sqlfpn")
sub(/^ static const char \*sq/, " static char *sq")
print
}

hope this helps.

Wayne Hoferkamp
PRC, Inc.



wayne_at_prcd.prc.mrms.navy.mil Received on Thu Feb 23 1995 - 21:39:22 CET

Original text of this message