Operating System - OpenVMS
1748092 Members
5938 Online
108758 Solutions
New Discussion юеВ

Re: How to *. c compiled as a shared library

 
ora_lion
Advisor

How to *. c compiled as a shared library

under openvms:
I would like to test.c compiled as a shared library,similar to the windows .dll library or under unix .so.

Can you help me achieve? Thank you.

10 REPLIES 10
John Gillings
Honored Contributor

Re: How to *. c compiled as a shared library

The OpenVMS equivalent is called a "Shareable Image".

You'll need to define a "symbol vector" naming all externally visible symbols, then use LINK/SHARE to create the image.

See the linker manual for details. I think there's a cheat sheet in the OpenVMS FAQ.
A crucible of informative mistakes
ora_lion
Advisor

Re: How to *. c compiled as a shared library

let me try! thank you.
Robert Gezelter
Honored Contributor

Re: How to *. c compiled as a shared library

ora_lion,

Shareable libraries are a powerful technique that is at the core of OpenVMS' approach to building software.

There have been several presentations over the years on using this technique.

I have done several of these. One of them is:

"OpenVMS Shareable Libraries: An Implementor's Guide". (slides at http://www.rlgsc.com/cets/2000/460.html )

- Bob Gezelter, http://www.rlgsc.com
Hoff
Honored Contributor

Re: How to *. c compiled as a shared library

ora_lion
Advisor

Re: How to *. c compiled as a shared library

I would like to call an external process in plsql.
under windows,
create or replace library libc_1 as 'D:\crtdll.dll'
/
create or replace package random_utl
as
function rand return pls_integer;
end random_utl;
/

create or replace package body random_utl
as
function rand return pls_integer
is
external
library libc_1
name "rand"
language C;
end random_utl;

SQL>select random_utl.rand from dual;
41


My question is,
I wrote a procedure test.c under openvms,but I do not know how to compiler as shareable libraries called by plsql like crtdll.dll.
Hoff
Honored Contributor

Re: How to *. c compiled as a shared library

What is it that you do not understand from the materials you have been pointed at?

Please recognize that OpenVMS and Windows are -- in many ways -- very different platforms. Very different. Sequences and tools and commands are very different.

Please do not map knowledge or expectations or assumptions of Windows (or Unix or another platform) onto OpenVMS.

That path leads only to frustration and pain and wasted effort.

Please take the time to read through the resources cited here, and through the available introductory and reference manuals for OpenVMS.

The OpenVMS User's Guide and the OpeNVMS Programming Concepts manual will introduce concepts and terms and norms that are critical to operating on OpenVMS. Then the LINKER utility documentation -- after reading through the materials Robert G. and I pointed to here in this thread -- can provide you with technical background on the linker itself.

The OpenVMS manuals are here:

http://www.hp.com/go/openvms/doc

Here's another (different) sequence toward building a shareable image on OpenVMS:

http://64.223.189.234/node/163

If you don't understand something from the available materials referenced here, please ask. Please point to the part of the materials you don't understand, or that need elaboration. (That question and that pointer also helps me, too, as I can use that to update and enhance the contents of the /node/163 topic, for instance.)

Do also consider some OpenVMS training, either formal class time or formal or informal on-site training, whether in China or elsewhere.

Stephen Hoffman
HoffmanLabs LLC


ora_lion
Advisor

Re: How to *. c compiled as a shared library

Hoff,
Perhaps you misunderstood me,my expression is not clear enough.
i want to call external process like c function in plsql,but don't know how to compiler.
Below this is my approach:
extproc.c
#include
int test()
{
return 1;
}

bld_extproc_demo.com --demo provided by oracle
$!
$!
$!
$! Copyright (c) 1997, 1999 by Oracle Corporation
$! NAME
$! bld_extproc_demo.com - Build and link external external procedure demo
$! USAGE: @bld_extproc_demo
$!
$! DESCRIPTION: build and link the external procedure demo program
$! RETURNS
$!
$! NOTES
$!
$! MODIFIED (MM/DD/YY)
$!
$! tarnold 04/29/98 - Creation
$!
$!-------------------------------------------
$!
$ write sys$output " - Compiling External Procedure Demo "
$ cc/include=(ora_rdbms,ora_netconfig_demo) -
/obj=ora_plsql_demo:extproc -
/nowarn ora_plsql_demo:extproc+sys$library:sys$starlet_c.tlb/lib
$ write sys$output " - Linking External Procedure Demo "
$ USER_OPTION_FILE = "ora_plsql_demo:extproc.opt/opt,"
$ loutl ora_plsql_demo:extproc "ora_plsql_demo:extproc.obj, ora_olb:plsql_objlib
/lib" ora_plsql_demo:extproc.map I

extproc.opt --demo provided by oracle
case_sensitive=YES
symbol_vector = (-
check_err=PROCEDURE,CHECK_ERR/check_err=PROCEDURE-
,UpdateSalary=PROCEDURE,UPDATESALARY/UpdateSalary=PROCEDURE-
,PercentComm=PROCEDURE,PERCENTCOMM/PercentComm=PROCEDURE-
,PercentComm_ByRef=PROCEDURE,PERCENTCOMM_BYREF/PercentComm_ByRef=PROCEDURE-
,EmpExp=PROCEDURE,EMPEXP/EmpExp=PROCEDURE-
,CheckEmpName=PROCEDURE,CHECKEMPNAME/CheckEmpName=PROCEDURE-
,LobDemo=PROCEDURE,LOBDEMO/LobDemo=PROCEDURE-
)
case_sensitive=NO

After ran bld_extproc_demo,extproc.exe produced.

then i called procedure test in plsql.
create or replace library libc_1 as 'dkb0:[oracle.oracore.demo]extproc.exe';
/
create or replace package test_utl
as
function test return pls_integer;
end test_utl;
/

create or replace package body test_utl
as
function test return pls_integer
is
external
library libc_1
name "test"
language C;
end test_utl;
/

i run the package.
SQL> select test_utl.test from dual;
select test_utl.test from dual
*
ERROR at line 1:
ORA-06521: PL/SQL: Error mapping function
ORA-06522: ERROR - vms_dlsym for file dkb0:[oracle.oracore.demo]extproc.exe;16
test
.
ora_lion
Advisor

Re: How to *. c compiled as a shared library

another demo.

$ type demo_plsql.com
$! Copyright (c) 2005 by Oracle Corporation
$!
$! NAME: DEMO_PLSQL.COM
$!
$! USAGE: @DEMO_PLSQL.COM
$!
$! FUNCTION: build plsql demos. Functional equivalent of
$!
$! make -f demo_plsql.mk demos
$!
$! on unix.
$!
$! NOTES:
$! Upon completion, the generated .EXE's can be run by hand.
$! This script depends on proper values for symbols: loutl, lnocic
$! and logicals: ora_olb and ora_util.
$!
$! MODIFIED:
$!
$! 03/25/2005 - ewittenb - initial creation.
$!
$!---------------------------------------------------------------------------
$!
$! Perform vms specific setup
$!
$ define ora_util ora_olb32
$ define ora_olb ora_olb32,ora_root:[rdbms],ora_root:[rdbms.lib32]
$!
$! USERID=scott/tiger
$ USERID="test/test"
$!
$! PROCPLSFLAGS= sqlcheck=full userid=$(USERID) CHAR_MAP=VARCHAR2, DBMS=V7
$! without decc$library_include, PROC will not find standard library headers.
$ PROCPLSFLAGS = " sqlcheck=full userid=''USERID' CHAR_MAP=VARCHAR2, DBMS=V7 in
clude=(decc$library_include:)"
$!
$! PCDEMOS= examp10 examp9 sample5 sample6
$ PCDEMOS = "examp10 examp9 sample5 sample6"
$!
$!
$! BUILDSCRIPT= exampbld
$ BUILDSCRIPT="exampbld"
$! LOADSCRIPT= examplod
$ LOADSCRIPT="examplod"
$!
$ call DEMOS
$!
$ exit



$DEMOS: SUBROUTINE
$! no params
$!
$! EQUIVALENT MAKEFILE LINES:
$! demos: $(PCDEMOS) extproc.so
$!
$! FULFILL MAKEFILE DEPENDENCIES
$!
$ call PCDEMOS
$ call EXTPROC_DOT_SO
$!
$! PERFORM MAKEFILE ACTIONS
$!
$! none
$!
$ ENDSUBROUTINE




$BUILDSCRIPT_AND_LOADSCRIPT: SUBROUTINE
$ scriptname = p1
$!
$! EQUIVALENT MAKEFILE LINES:
$! $(BUILDSCRIPT) $(LOADSCRIPT):
$! $(ORACLE_HOME)/bin/sqlplus $(USERID) @$@ $!
$!
$! FULFILL MAKEFILE DEPENDENCIES
$!
$! none
$!
$! PERFORM MAKEFILE ACTIONS
$!
$ verify = f$verify(1)
$ sqlplus "''USERID'" @'scriptname' ! EWW todo note unix sets stdin to /dev/nul
l. May need to set sys$input to NL:
$ verify = 'f$verify(verify)'
$!
$!
$ ENDSUBROUTINE



$PC_TO_OBJ: SUBROUTINE
$ file_nameonly = p1
$!
$! EQUIVALENT MAKEFILE LINES
$! .pc.o:
$! $(ORACLE_HOME)/bin/proc $(PROCPLSFLAGS) iname=$*.pc
$! $(CC) $(CFLAGS) $(PRECOMPPUBLIC) -c $*.c
$!
$ verify = f$verify(1)
$ proc 'PROCPLSFLAGS' iname='file_nameonly'.pc
$ verify = 'f$verify(verify)'
$!
$ call C_TO_OBJ 'file_nameonly'
$!
$ ENDSUBROUTINE




$C_TO_OBJ: SUBROUTINE
$ file_nameonly = p1
$!
$ verify = f$verify(1)
$ cc -
/arch=ev56 -
/opt=tune=ev6 -
/extern=strict -
/prefix=all -
/nostandard -
/noansi -
/name=(short,as_is) -
/assume=(nowritable_string_literals) -
/float=ieee -
/ieee=denorm -
/gran=byte -
/debug=trace -
/warn=(dis=(UNREACH,LVALUECAST,QUESTCOMPARE,QUESTCOMPARE1,PTRMISMATCH1)) -
/poin=32 -
/list='file_nameonly'.lis/show=all -
'file_nameonly'.c + decc$library:[000000]DECC$RTLDEF.TLB/LIB -
/include=(sys$disk:[],ora_root:[rdbms.public],ora_root:[network_src.public])
$ verify = 'f$verify(verify)'
$!
$ ENDSUBROUTINE




$BUILD: SUBROUTINE ! functionally this is a LINK operation.
$ exe = p1
$ objs = p2
$!
$! EQUIVALENT MAKEFILE LINES
$! build: $(OBJS)
$! $(CC) $(CFLAGS) -o $(EXE) $(OBJS) -L$(LIBHOME) $(DEMO_LIBS)
$!
$! FULFILL MAKEFILE DEPENDENCIES
$!
$ obj_filename = f$parse(objs,,,"name")
$ call PC_TO_OBJ 'obj_filename'
$!
$! PERFORM MAKEFILE ACTIONS
$!
$! EWW todo
$! @ora_root:[rdbms.port.vms.install.util]loutl.com examp10.exe examp10.obj exam
p10.map NS I"
$!
$ write sys$output "lnocic ''exe' ''objs'"
$ lnocic 'exe' 'objs'
$!
$ ENDSUBROUTINE




$EXTPROC_DOT_SO: SUBROUTINE
$!
$! EQUIVALENT MAKEFILE LINES
$! extproc.so:
$! $(MAKE) -f $(EXTP_MAKEFILE) extproc_callback SHARED_LIBNAME=extproc.so
OBJS="extproc.o"
$! BUILDLIB_WITH_CONTEXT=$(LD) $(SHARED_LDFLAG) $(SHARED_LIBNAME) $(OBJS)
$(LIBEXTP) $(OCISHAREDLIBS)
$!
$! FULFILL MAKEFILE DEPENDENCIES
$!
$! none
$!
$! PERFORM MAKEFILE ACTIONS
$!
$ call C_TO_OBJ extproc
$!
$ loutl extproc.so "extproc.obj,extproc.opt/opt" extproc.map NS I
$!
$ ENDSUBROUTINE




$PCDEMOS: SUBROUTINE
$!
$! $(PCDEMOS): $(BUILDSCRIPT) $(LOADSCRIPT)
$! $(MAKE) -f $(DEMO_MAKEFILE) build EXE=$@ OBJS=$@.o
$!
$!
$! FULFILL MAKEFILE DEPENDENCIES
$!
$ call BUILDSCRIPT_AND_LOADSCRIPT 'buildscript'
$ call BUILDSCRIPT_AND_LOADSCRIPT 'loadscript'
$!
$! PERFORM MAKEFILE ACTIONS
$!
$ pcdemos_index = 0
$MORE_PCDEMOS:
$ this_pcdemo = f$element(pcdemos_index, " ", PCDEMOS)
$ if this_pcdemo .eqs. " " then goto done_pcdemos
$!
$ call BUILD 'this_pcdemo' 'this_pcdemo'.obj
$!
$ pcdemos_index = pcdemos_index + 1
$ goto more_pcdemos
$DONE_PCDEMOS:
$!
$ ENDSUBROUTINE

$ show sym loutl
LOUTL == "@ORA_SYSTEM:loutl.com"

type ORA_SYSTEM:loutl.com
$! Copyright (c) 1986, 1996, 1997, 2000 by Oracle Corporation
$!
$! NAME: LOUTL.COM
$! USAGE: loutl exe libinfo mapname [flags]
$! FUNCTION: Link Oracle UTIlities command file
$!
$! NOTES:
$! Most part of loutl.com has been rewritten for ORACLE8 to
$! facilitate linking oracle utilities in an optimized manner.
$! These changes should be transparent to the user. All the loutl
$! flags of pre-ORACLE8 release will continue to exist for backward
$! compatability.
$! loutl is not used to link the server. Flags specific to server
$! have been moved to server link scripts. eg. "O"
$!
$! MODIFIED:
$!
$! 01/26/2006 - tmontgom - Remove "pic" attribute from psect_attr.
$! Causes informational on Itanium and is not used by
Alpha.
$! 09/26/2005 - jferlan - Add Itanium specific changes
$! 04/15/2004 - tmontgom - Update for 10i final label. libtrace9 libraries h
ave been obsoleted.
$! 10/20/2003 - ksviswan - change libxsd10 to libxml10
$! 05/08/2003 - tmontgom - Update for 10i.
$! 07/19/2002 - tmontgom - Update for 9.2.
$! 09/06/2001 - tmontgom - Update for 9i, add ocicob to command line when usi
ng the V option.
$! 03/12/2001 - tmontgom - Update for 9i.
$! 11/03/2000 - tmontgom - Update for 8.1.7. Add support for SBT package.
$! 08/16/2000 - tmontgom - Update for 8.1.7. Add kpuadef.
$! 05/01/2000 - APurmal - added NS (non-shared) link option
$! 09/20/1999 - ghuffman - fix for shared libraries
$! 07/13/98 - sudhakar - fix for S0MAIN based executables
$! 08/27/97 - sudhakar - creation: oracle8
$!
$!---------------------------------------------------------------------------
$!
$! Parameters: Image file name
$! Object files to be included (libraries recommended)
$! Map file name
$! CPP - Link using CXXLINK for C++ files
$! D - include the VMS symbolic debugger
$! F - produce a full map
$! I - utility is linked as a shared image
$! LD - Do not link with ORA_DEBUG.OPT - not used anymore
$! LS - Do not link with SLDBG.OPT - not used anymore
$! M - produce a map file
$! N - link with notrace option instead of default trace.
$! NS - link non-shared without the shareable image(s)
$! O - dispatching mechanism option - moved to server link script
$! PCA - link in PCA (pca must be fully specified)
$! R - Link with using RMAN share options
$! S - This was the old shareable option, you will now run with
$! a 'T' option now
$! Q - link with ORACLE Client shareable image. If not specified,
link
$! all of ORACLE Client into resulting image.
$! SPM - include the performance monitor (spm)
$! SPM1 - include the performance monitor (spm) but DON'T
$! automagically start it; it will be started by
$! a call from the user program
$! (spm/spm1 must be fully specified)
$! T - produce a two-task Oracle image
$! U - produce an Oracle image with*out*
$! improved UPI (bigger,faster),
$! ie use the smaller, slower, old UPI
$! V - support for fortran oci programs (Oracle internal)
$! X - produce a map with a cross reference
$! Z - utility which doesn't connect to Oracle
$!
$ if ((p1.eqs."") .or. (p2.eqs."") .or. (p3.eqs.""))
$ then
$ write sys$output "LOUTL.COM: Not enough arguments supplied. Exiting."
$ exit
$ endif
$
$!
$! Make sure we know the architecture
$!
$! support for ALPHA/IA64 only.
$!
$ arch$$ = f$edit("''f$getsyi ("ARCH_NAME")'","UPCASE")
$ if "''arch$$'" .nes. "ALPHA" .and. "''arch$$'" .nes. "IA64"
$ then
$ write sys$output "LOUTL.COM: Unsupported architecture ''arch$$'. Exiting."
$ exit 0
$ endif
$ filename$$ = f$parse(p1,".exe",,,"syntax_only")
$ write sys$output " - Linking ",f$parse(filename$$,,,"name","syntax_only"), -
f$parse(filename$$,,,"type","syntax_only")
$ mapname$$ = f$parse(p3,".map",,,"syntax_only")
$!
$ parms$$ := "|''p4'|''p5'|''p6'|''p7'|''p8'|"
$ parms$$ = f$edit(parms$$,"upcase")
$ lparms$$ = 'f$length(parms$$)'
$ dbgpos$ = 'f$locate("D", parms$$)'
$ dbg$$ = ((dbgpos$ .ne. lparms$$) .and. -
(f$extract((dbgpos$ - 1), 1, parms$$) .nes. "L"))
$ cpp$$ = ( 'f$locate("CPP", parms$$)' .ne. lparms$$ )
$ f$$ = ( 'f$locate("F", parms$$)' .ne. lparms$$ )
$ i$$ = ( 'f$locate("I", parms$$)' .ne. lparms$$ )
$ ld$$ = ( 'f$locate("|LD|", parms$$)' .ne. lparms$$ )
$ ls$$ = ( 'f$locate("|LS|", parms$$)' .ne. lparms$$ )
$ m$$ = ( 'f$locate("M", parms$$)' .ne. lparms$$ )
$ notrc$$ = ( 'f$locate("N", parms$$)' .ne. lparms$$ )
$ ns$$ = ( 'f$locate("|NS|", parms$$)' .ne. lparms$$ )
$! move this to server script.
$! dsp$$ = ( 'f$locate("O", parms$$)' .ne. lparms$$ )
$ pca$$ = ( 'f$locate("|PCA|", parms$$)' .ne. lparms$$ )
$ r$$ = ( 'f$locate("R", parms$$)' .ne. lparms$$ )
$ spm$$ = ( 'f$locate("|SPM|", parms$$)' .ne. lparms$$ )
$ spm1$$ = ( 'f$locate("|SPM1|", parms$$)' .ne. lparms$$ )
$ t$$ = ( 'f$locate("T", parms$$)' .ne. lparms$$ )
$ u$$ = ( 'f$locate("U", parms$$)' .ne. lparms$$ )
$ v$$ = ( 'f$locate("V", parms$$)' .ne. lparms$$ )
$ x$$ = ( 'f$locate("X", parms$$)' .ne. lparms$$ )
$ z$$ = ( 'f$locate("Z", parms$$)' .ne. lparms$$ )
$ sharepos$ = 'f$locate("S", parms$$)'
$ share$$ = ((sharepos$ .ne. lparms$$) .and. -
(f$extract((dbgpos$ - 1), 1, parms$$) .nes. "L"))
$!
$! if linking shared (old method) now it is twotask.
$!
$ if share$$
$ then
$ t$$=1
$ share$$ = 0
$ endif
$! Incase you know about The Q.
$ share$$ = ( 'f$locate("Q", parms$$)' .ne. lparms$$ )
$!
$!
$! If spm is included, need map, get rid of debug/share.
$ if (spm$$ .eq. 1) then m$$ := 1
$ if (spm$$ .eq. 1) then f$$ := 1
$ if (spm$$ .eq. 1) then dbg$$ := 0
$ if (spm$$ .eq. 1) then share$$ := 0
$!
$! loutl link command is:
$ loutl_link_cmd$$ = "LINK"
$ if (CPP$$ .eq. 1) then loutl_link_cmd$$ = "CXXLINK"
$ map$$ = "/nomap"
$ mapextra$$ = ""
$ if (m$$ .eq. 1) then map$$ = "/map=''mapname$$'"
$ if ((m$$ .eq. 1) .and. (f$$ .eq. 1)) then mapextra$$ = "/full"
$ if ((m$$ .eq. 1) .and. (x$$ .eq. 1)) then mapextra$$ = "/full/cross_ref"
$!
$ dotrace$$ := "/trace"
$ if (notrc$$ .eq. 1) then dotrace$$ := "/notrace"
$!
$ userlib$$ = "/nouserlibrary"
$ cxxlib$$ = ""
$ if (CPP$$ .eq. 1)
$ then
$ ! Alpha needs to link against this library to pick up some symbols
$ if ("''arch$$'" .eqs. "ALPHA")
$ then
$ cxxlib$$ = "SYS$library:LIBCXXSTD/lib,"
$ endif
$ userlib$$ = ""
$ endif
$ switch$$ := ""
$ dbglib$$ = ""
$ spmopt$$ = ""
$ ocis$$ = "" ! "ocicee equivalent now in libclient10"
$ fastupi$$ = "ora_olb:kpudfo.obj," ! new, improved
$ if (dbg$$ .eq. 1) then switch$$ := "/debug"
$ if (spm$$ .eq. 1) then spmopt$$ = "sys$library:spmsample/opt,"
$ if ((spm$$ .eq. 1) .and. (spm1$$ .eq. 0)) then -
switch$$ := "/debug=sys$library:spmshell"
$ if (pca$$ .eq. 1) then switch$$ := "/debug=sys$library:pca$obj.obj"
$ if (u$$ .eq. 1) then fastupi$$ = "ora_olb:kpundf.obj," ! original recipe
$!
$! ocifor,ocicob now in libclient10.
$! lower case is C, upcase cobol, underscore name are fortran.
$!
$ if (v$$ .eq. 1) then ocis$$ = ""
$!
$ image$$ = "/exe"
$ if (i$$ .eq. 1)
$ then
$ image$$ = "/share"
$ endif
$!
$ plsql$$ = "ora_olb:plsql/opt,"
$ rdbms2$$ = ""
$ rdbmslib$$ = "ora_olb:rdbms/opt,"
$ rdbmslib_noshare$$ = "ora_olb:rdbms_noshare/opt,"
$ if (r$$ .eq. 1) then rdbmslib_noshare$$ = "ora_olb:rdbms_rman_noshare/opt,"
$ oracore$$ = "ora_olb:core/opt,"
$ network_et$$ = "ora_olb:network_et/opt,"
$ network$$ = "ora_olb:network/opt,"
$ otracelib$$ = "ora_olb:libtrace9/lib,ora_olb:libtracefe9/lib,ora_olb:libtrace9
/lib,ora_olb:libtracept9/lib,"
$!
$! User Option file support
$!
$ useroption$$ = ""
$ if ("''USER_OPTION_FILE'" .nes. "") then -
useroption$$ = USER_OPTION_FILE
$!
$! User Link qualifier support
$!
$ userlink$$ = ""
$ if ("''USER_LINK_OPTIONS'" .nes. "") then -
userlink$$ = USER_LINK_OPTIONS
$!
$! Optionally display link command.
$!
$ verstat$$ = f$verify()
$ if ("''show_link_command'" .nes. "") then -
verstat$$ = f$verify(1)
$!
$! Dispatch on link type
$ IF (ns$$ .EQ. 1) THEN GOTO nonSharedLink
$ if ( (t$$ .eq. 1) .or. (z$$ .eq. 1) ) then goto zOrTwoTask
$ if (share$$ .eq. 1) then goto zOrTwoTask
$!
$nonSharedLink:
$ 'loutl_link_cmd$$''userlib$$''dotrace$$''map$$''mapextra$$''image$$'='filename
$$''switch$$''userlink$$'/sysexe -
'p2',-
'cxxlib$$'-
ora_olb:libclient10/lib,-
ora_olb:libsql10/lib,-
'ocis$$'-
'fastupi$$'-
'network_et$$'-
'network$$'-
'rdbmslib_noshare$$'-
'oracore$$'-
'network$$'-
'rdbmslib_noshare$$'-
'oracore$$'-
'plsql$$'-
'rdbmslib_noshare$$'-
ora_olb:libxml10/lib,-
'network$$'-
'oracore$$'-
'rdbms2$$'-
'useroption$$'-
sys$input/opt
sys$share:decc$shr/share
sys$share:trace.exe/shareable
! Temporary: fixup readonly attributes between compiler versions.
psect_attr = $readonly$,shr
$ goto finish
$!
$ zOrTwoTask:
$ 'loutl_link_cmd$$''userlib$$''dotrace$$''map$$''mapextra$$''image$$'='filename
$$''switch$$''userlink$$'/sysexe -
'p2',-
ora_olb:oraclient/opt,-
'useroption$$'-
sys$input/opt
sys$share:decc$shr/share
sys$share:trace.exe/shareable
! Temporary: fixup readonly attributes between compiler versions.
psect_attr = $readonly$,shr
psect_attr = $readonly$,shr
$finish:
$!
$! Preserve link command status code
$!
$ finalsts$$ = $status
$!
$! Restore verify state.
$!
$ dummy = f$verify(verstat$$)
$!
$! Clean up files left around
$!
$ if (f$search(filename$$) .nes. "")
$ then
$ filename$$=filename$$ - ";"
$ purge/nolog/noconfirm 'filename$$'
$ endif
$ if (f$search(mapname$$) .nes. "")
$ then
$ mapname$$=mapname$$ - ";"
$ purge/nolog/noconfirm 'mapname$$'
$ endif
$!
$! Return link command's status to the user
$!
$ exit 'finalsts$$'
ora_lion
Advisor

Re: How to *. c compiled as a shared library

$ type extproc_demo.txt




EXTPROC AGENT DEMO
----------------------

The appropriate External Procedure Agent adapter script must be present,
and edited to contain the appropriate parameters for the user's installation.

ORA_ROOT:[RDBMS]ORASRV_HO_EXTPROC.COM

The user must also make sure that the appropriate changes are made to the
LISTENER.ORA and TNSNAMES.ORA files to point to the External Procedure Agent
adapter script.

ORA_ROOT:[NETWORK.ADMIN]TNSNAMES.ORA
ORA_ROOT:[NETWORK.ADMIN]LISTENER.ORA

Please review the changes that are required with the delivered files for the
patch TNSNAMES.ORA_EXTPROC and LISTENER.ORA_EXTPROC.

To run the demo, the user must perform the above mentioned steps, and then run
the BLD_EXTPROC_DEMO procedure. Then they must follow the directions in the
EXTPROC.SQL file, except that the CREATE LIBRARY command should be as follows:

CREATE OR REPLACE LIBRARY demolib IS 'ORA_PLSQL_DEMO:EXTPROC.EXE';

Then the user can use SQLPLUS to connect to scott/tiger, and run the
EXTPROC.SQL script.



STEPS FOR BUILDING EXTPROC DEMO IN ORA_PLSQL_DEMO
---------------------------------------------------

The following are the directions that need to be followed in order for the DEMO
to run.

1) Build the EXTPROC.EXE in ORA_PLSQL_DEMO location by activating command
procedure BLD_EXTPROC_DEMO.COM. This will generate a EXTPROC.EXE in the
ORA_PLSQL_DEMO location.

2) Make the required changes in the following files.

a) ORA_ROOT:[NETWORK.ADMIN]LISTENER.ORA
b) ORA_ROOT:[NETWORK.ADMIN]TNSNAMES.ORA
c) ORA_ROOT:[RDBMS]ORASRV_HO_EXTPROC.COM

The changes are required for the location of ORACLE_HOME, SID NAME, etc.
Without these changes the external procedure agent will not work.

3) Startup the listener and make sure that the extproc service is now
available. Also make sure that the database has been started.

4) For running the newly created EXTPROC.EXE which resides in the directory
ORA_PLSQL_DEMO the following SQL commands must be executed.

$ set default ora_plsql_demo
$ sqlplus system/manager
SQL> grant create library to scott identified by tiger;
SQL> connect scott/tiger
SQL> CREATE OR REPLACE LIBRARY demolib IS 'ORA_PLSQL_DEMO:EXTPROC.EXE';
SQL> /
SQL> @extproc.sql

5) The demo now completes as it should.