Re: How do I write a Pro*C Program?

From: Naser El-Bathy <nelbathy_at_ford.com>
Date: 17 Oct 2002 15:00:35 -0700
Message-ID: <38ccdbd.0210171400.4be0c4c6_at_posting.google.com>


Dave <David.W.Spencer_at_elcaro.moc> wrote in message news:<3DAEA03D.801_at_elcaro.moc>...
> You will also find a makefile in that same directory, demo_proc.mk.
>
> This is flexible enough to build some quite complex apps, only breaking
> down when you want to add some other libraries to the application.
>
> For a simple program, test.pc, that contains no PL/SQL, it can be
> invoked thus:
>
> make -f demo_proc.mk build EXE=test OBJS=test.o
>
> This will build an executable from test.pc.
>
> If you have multiple .c and/or .pc source files, for example ccode1.c
> ccode2.c, pccode1.pc pccode2.pc, this can be built into an executable
> called myexe as follows:
>
> make -f demo_proc.mk build EXE=myexe OBJS="ccode1.o ccode2.o pccode1.o
> pccode2.o"
>
> (That should all be on one line.)
>
> Inspection of the makefile will show you how to invoke it for static or
> dynamic linking, with or without PL/SQL, how to add libraries and a
> substantial host of other build methods. It's quite complex so the
> easiest approach is probably to pick a particular target and work
> backwards from there.
>
> Dave.
>
>
> Brian Peasland wrote:
> > Have you installed the Pro*C precompiler on your system? That is the
> > first step. After you've installed it, you will find several Pro*C
> > examples in $ORACLE_HOME/precomp/demo/proc. Once you have a written
> > program, you need to run it through the precompiler with the 'proc'
> > utility. This will create your C program for you. Then run this C
> > program through your C compiler.
> >
> > For futher information, please refer to the Oracle docs
> > (http://tahiti.oracle.com).
> >
> > HTH,
> > Brian
> >
> > Naser El-Bathy wrote:
> >
> >>Hi,
> >>
> >>I'm trying to write a very small Pro*C program and I'm trying to run
> >>it. However, I have a difficulty writing it.
> >>
> >>Please, can you write me small program and explain how to run it on
> >>UNIX?
> >>
> >>How to connect it to my database application?
> >>
> >>Your assistance is appreciated.
> >
Thank you for your explanation. However, I'm still bit confused. [Quoted] I already have sample programs under demo directory and I'm trying to run for example sample1. So, the following steps I have to follow:

1) proc sample1
2) cc sample1.c
3) make -f demo_proc.mk build EXE=sample1 OBJS=sample1.o

Do I have to be under demo directory to write my code? And now, I should get the out put of the program.

Please advise.

Also, do you mean if write any other code, this should work on demo_proc.mk? Received on Fri Oct 18 2002 - 00:00:35 CEST

Original text of this message