Operating System - HP-UX
1753437 Members
4669 Online
108794 Solutions
New Discussion юеВ

Re: How to compile and link the PRO*C source file in HP-UX?

 
MA Qiang
Regular Advisor

How to compile and link the PRO*C source file in HP-UX?

I do not want to use the makefile which is provided by oracle demo. Because I will link some special objects for my application.
Please give me some command line samples:

proc iname=test1.pc
cc -o test1.c myobj.o -IXXX -LYYY -lZZZ
I don't know which options should be used.
How to set XXX, YYY and ZZZ?

Thank you!
5 REPLIES 5
H.Merijn Brand (procura
Honored Contributor

Re: How to compile and link the PRO*C source file in HP-UX?

I just don't believe that what the example states is correct, because -o test1.c would use "test1.c" as *outpur* of the compiler

-IXXX is a (repeated) list of include folders

cc -I/usr/local/include -I. -I/why/do/we/need/oracle/version_11/include ...

these specify the locations of where the header/include files can be found when a source file doe

#include

-LYYY indicates where the linker (ld) can find the (shared) libraries when turning the objects into executables. These will not be handled by cc, but passed to ld

cc -o test1 test1.o -L/usr/lib -L/usr/local/lib -L/still/using/oracle\?/lib ...

-lZZZ is a (repeated) list of libraries the object needs to be able to run. These (shared) libraries will be found in the locations you just specified with -L

cc -o test1 test1.o -L/usr/local/lib -lc -lm -lmysql ...

Since Oracle is a product that complies to no standards whatsoever, I cannot tell you where it is installed, nor what your flags could be. A good indication might be your environment flag $ORACLE_HOME.

All this is explained in

# man cc

and

# man ld

Sorry for the sceptic tone, but I realy realy realy don't like Oracle. It's super for end-users, but it's like hell for developers

Enjoy, Have FUN! H.Merijn
Enjoy, Have FUN! H.Merijn
MA Qiang
Regular Advisor

Re: How to compile and link the PRO*C source file in HP-UX?

I want to know which LIBs I should link for oracle PRO*C.

Regards.
H.Merijn Brand (procura
Honored Contributor

Re: How to compile and link the PRO*C source file in HP-UX?

I cannot tell from here.

if your test1.c looks like

--8<---
int main (int argc, char *argv[])
{
return 0);
} /* main */
-->8---

You don't have to link *any* oracle libs at all. What you have to link completely depends on what functionality your C program has.

I also depends on which version of Oracle you are running, and if it is 32bit or 64bit.

It also depends on what C compiler you use

It probably also depends on the phase of the moon when I think back of all the problems I had with Oracle and migrations between all the versions of it.

A typical application at our site for HP-UX 11i in 64bit mode for Oracle-9.2 looks like

cc +DA2.0w -o /applic/bin/applic -g -L/applic/local/lib -L/junk/oracle/v920/lib here.a version.o \
-lpthread -lcl \
-lfoo -lbar -lbaz -lurk -lsys -lcurses -lclntsh -lcl -lm -lmc -lssl -lcrypto -lc -lmb -lpcre \
-lcl -lm -l:libcl.a

Does that help?

Enjoy, Have FUN! H.Merijn
Enjoy, Have FUN! H.Merijn
Eric Antunes
Honored Contributor

Re: How to compile and link the PRO*C source file in HP-UX?

Hi,

I'm not sure if I understood the question but you can use the INCLUDE to tell Pro*C what directory my header files are in:

proc iname=inputfile.pc include=directory1 include=directory2...

Best Regards,

Eric Antunes
Each and every day is a good day to learn.
Jean-Luc Oudart
Honored Contributor

Re: How to compile and link the PRO*C source file in HP-UX?

HI

-l specifies the name of the library to include.
-L (before -l option) tells the linker to search for the library in this path 1st before searching in default location
-lx is for library name libx.sl or libx.a
cf. man cc

also I suggest you check these document on Metalink regarding Pro*C :

Note:9743.1 Understanding and Modifying Precompiler and OCI Makefiles
Note:170345.1 How to Create and Use Libraries in Pro*C
Note:100741.1 Linking in User-Supplied Libraries Using Pro*C
Note:68164.1 Pro*C Makefiles in 8.0 Explained

Regards
Jean-Luc

fiat lux