Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.tools -> How to do an external procedure call to an OpenVMS Shared library?

How to do an external procedure call to an OpenVMS Shared library?

From: Ivan Samuelson <isamuels_at_columbus.rr.com>
Date: 24 Jul 2001 08:05:51 -0700
Message-ID: <9e3f3c6.0107240705.6414bd3@posting.google.com>

I'm trying to call c runtime functions in the OpenVMS libraries, but it doesn't seem to work when trying to do it directly through the shared libraries themselves.

For example, I want to call the system() function. However, I'm not sure what library to link against. I've tried many different ones in the SYS$SHARE directory.

Here's an example of the library definition:

create or replace library call_system as 'DEVCEA$DRA0:[SYS0.SYSCOMMON.SYSLIB]imagelib.olb';

I then create the wrapper package for this:

CREATE OR REPLACE package system_call as FUNCTION system (p_command IN VARCHAR2) RETURN PLS_INTEGER; PRAGMA RESTRICT_REFERENCES (system, WNPS, RNPS, WNDS, RNDS); END system_call;
/

CREATE OR REPLACE package body system_call as FUNCTION system (p_command IN VARCHAR2) RETURN PLS_INTEGER IS EXTERNAL
LIBRARY call_system
NAME "system"
LANGUAGE C
PARAMETERS (p_command STRING);
end system_call;
/

Finally, if I do the following:

declare
v_status NUMBER;
begin
v_status := system_call.system('mail/subject="Howdy" NL: smtp%"ivan_samuelson_at_aepsc.com"');

dbms_output.put_line ('v_status = ' || v_status); end;

I get the following error message:

ORA-06521: PL/SQL: Error mapping function
ORA-06522:  ERROR - vms_dlsym for file SYS$LIBRARY:imagelib.olb system
ORA-06512: at "CEAS.SYSTEM_CALL", line 0
ORA-06512: at line 4

Is the only way to do this in VMS is to just create a "wrapper" application .EXE that I compile and link as shareable? Under other platforms, such as Unix, I can directly call functions defined in the libc.so library (for Linux, in this case). Same goes for Windows, calling a function in say, Kernel32.dll.

How do you do this under VMS? I can't find any examples other than those that create a wrapper .EXE shareable image.

Thanks! Received on Tue Jul 24 2001 - 10:05:51 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US