Re: Libraries to link ( Pro*C executable with SQL*Net2.0 )

From: Thomas J Kyte <tkyte_at_us.oracle.com>
Date: 1995/07/24
Message-ID: <3uuo7l$msa_at_inet-nntp-gw-1.us.oracle.com>


Anton V. Gruza <ant_at_geol.spb.su> wrote:

>Hi, world !
 

>Is there anybody able to give me a clear sense about Oracle makefiles for
>Pro*C programs ? What libraries are needed for Pro*C executable for being able
>to connect over SQL*Net 2.1 ? Why have <proc.mk> makefile got "-lsqlnet -lora"
>twice ?
 

>**********************************************************************
>proc16 iname=sample1.pc include=/d202/dba/oracle/7.1.3/sqllib/public
>ireclen=132 oreclen=132 sqlcheck=none ltype=none
>/d202/dba/oracle/7.1.3/bin/echodo
>cc -I. -O -xcg92 -L/d202/dba/oracle/7.1.3/lib
>-o sample1 sample1.c
>-lsql /d202/dba/oracle/7.1.3/lib/osntab.o
>-lsqlnet -lora -lsqlnet -lora -lnlsrtl -lcv6 -lcore -lnlsrtl -lcv6
> -lcore `cat /d202/dba/oracle/7.1.3/rdbms/lib/sysliblist`
>***********************************************************************
 

>As far as I understand, the people of Oracle doesn't like
>3GL programming at all, :-(. I've got now 7.1.3 - the third release since
>the first 6.0.36 I've been dealing with - and all I could see is the same
>UGLY, WITHOUT ANY RESPECT TO CUSTOMERS makefile in proc/demo directory
>( on Unix box ). I understand that programming with GUI tools is very
>popular - but there are a lot of things they are unable to implement so
>I need 3GL.
 

>Is it so hard to give programmers clear ideas about the libraries they need
>to link ? Two years ago I considered Unix and all stuff concerning it VERY
>COMPLICATED by nature ( looking at 6.x.x release of Oracle ) - but now
>I realize that it is not the feature of Unix - it's the feature of people
>writing Unix programs. I'm very sorry about this.
 

>That's why the market is going to Microsoft monopoly,
>there is lot of pretty buttons there without makefiles and scripts ....

(btw, I have wasted more afternoons trying to use MS software, then I care to remember. Buttons really bother me when they don't work)

>Anton

Ok, here is the process I use to link together Oracle applications on any version and any unix platform.

My method of operation is to keep all .pc files for an application in one directory. If I have a utility library, I use ar to create a .a file to link in later.

Basically, if I have a directory full of .pc files to build into an executable, I use the following csh script and the worlds shortest makefile. This has been tested on Oracle versions 7.0.9 through 7.2, OS's too numerable to count.

Take a look at the makefile, should show you how to make the TARGET of your compile and link.

The reason I used a csh and a makefile is that some platforms do not support makefiles executing subshells. I use the csh to gather some information that on many platforms could be done in the makefile.

  • procmk ------- CSH script ------------ 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 for example setenv PROC_ENV_FLAGS "sqlcheck=semantics userid=scott/tiger" echo Remember you can set CC_ENV_FLAGS to pass things to CC

make -f /home/tkyte/bin/proc.mk "SOURCE=$SRC" "TARGET=$TGT" # CHANGE THE ABOVE path to point to where you put proc.mk

-------------- end procmk ------------------------------


-----------proc.mk ----- MAKEFILE ----------------------
$(TARGET): $(SOURCE) $(SOURCE:.pc=.c) $(SOURCE:.pc=.o)
	$(CC) $(LDFLAGS) -o $(TARGET) \
		$(SOURCE:.pc=.o) \
		$(PROLDLIBS)

#put your libs here and add a \ to the previous line.....

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

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

                   include=$(ORACLE_HOME)/proc/lib
#customize the PROFLAGS above to suit yourself

CFLAGS=-I. -g $(CC_ENV_FLAGS)
#same as PROFLAGS, customize to your environment

--------------- end proc.mk--------------------------


Using the procmk and proc.mk file, I can have a directory full of .pc files that will get compiled into .c files and compiled and linked into executables. If you want to use makedepends etc.... you will have to customize.

Basically, the line reading:

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

	$(CC) $(LDFLAGS) -o $(TARGET) \
		$(SOURCE:.pc=.o) \
		$(PROLDLIBS)

Answers your question. You need to get the $(PROLDLIBS) from the $(ORACLE_HOME)/proc/demo/proc.mk file. I include it to get it.

Thomas Kyte
tkyte_at_us.oracle.com
Oracle Government Received on Mon Jul 24 1995 - 00:00:00 CEST

Original text of this message