Re: Pro*C Linking

From: Thomas J. Kyte <tkyte_at_us.oracle.com>
Date: 1996/07/16
Message-ID: <31eba420.6358412_at_dcsun4>#1/1


On Mon, 15 Jul 1996 14:05:19 GMT, mke2e_at_viper.cs.Virginia.EDU (Michael Esler) wrote:

>
>After successfully precompiling (using Pro*C) and compiling (into onjects)
>a .pc file, which libraries need to be linked in?
>
>I was unable to find the documentation on this, so a pointer to the right
>document would be helpful as well.
>
>Thanks in advance.
>
>--
>Michael Esler
>esler_at_cs.Virginia.EDU

Here is the makefile I use:



$(TARGET): $(SOURCE) $(SOURCE:.pc=.c) $(SOURCE:.pc=.o)

    $(CC) $(LDFLAGS) -t -o $(TARGET) \

        $(SOURCE:.pc=.o) $(PROLDLIBS)  

include $(ORACLE_HOME)/proc/demo/proc.mk  

PROFLAGS= ireclen=255 lines=yes $(PROC_ENV_FLAGS) \

           include=$(ORACLE_HOME)/proc/lib CFLAGS=-I. -g $(CC_ENV_FLAGS)


You set the TARGET and SOURCE fields in the makefile and it does the rest. Precompiles/compiles and links pro*c. The trick is to include the standard oracle makefile (ignore it's trickyness alltogether, it is a makefile that can build everything/anything on quite a few platforms. This tends to make it not so readable).

I use the following shell script to build my programs. It assumes that you are in a subdirectory, the subdirectory is named after the program you want to build (eg: /home/tkyte/src/program1 would assume a TARGET of program1). It also assumes that the current directory is full of .pc files you want compiled/precompiled/linked together to build that program. I have used this on many UNIX systems unchanged.

NOTE: the above makefile needs to change for 7.3. The include will include $ORACLE_HOME/precomp/demo/proc/proc.mk as they moved the makefile.


 

SRC=`echo *.pc`
TGT=`pwd | sed 's".*/""'`  

echo SRC = $SRC
echo TGT = $TGT
echo Remember you can set PROC_ENV_FLAGS to pass things to ProC echo Remember you can set CC_ENV_FLAGS to pass things to CC  

make -f /export/home/tkyte/bin/proc.mk "SOURCE=$SRC" "TARGET=$TGT"


Thomas Kyte
Oracle Government
tkyte_at_us.oracle.com                          

http://govt.us.oracle.com -- Check out our web site! Brand new, uses Oracle Web Server and Database


statements and opinions are mine and do not necessarily reflect the opinions of Oracle Corporation Received on Tue Jul 16 1996 - 00:00:00 CEST

Original text of this message