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

From: Dave <David.W.Spencer_at_elcaro.moc>
Date: Thu, 17 Oct 2002 12:34:21 +0100
Message-ID: <3DAEA03D.801_at_elcaro.moc>


[Quoted] 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.

>
-- 
Email address munged to avoid SPAM
Reverse the last two parts to reply directly
Received on Thu Oct 17 2002 - 13:34:21 CEST

Original text of this message