HP OpenVMS Systems

ask the wizard
Content starts here

C and argument passing? (lib$getjpi)

» close window

The Question is:

Am trying to migrate a application written in DEC vax6.2 to aplha vms v7.2.
Basically am facing some problems related to RTL's - for example the below
 piece of code written in v6.2, when executed in v7.2 it crashes. Could you
 please provide me a solution to this problem:
#include <ssdef>
#include <jpidef>
int sc_pid, test_pid, ret_status;
short int result_len;
 ret_status = LIB$GETJPI( JPI$_PID,

The Answer is :

  The OpenVMS Wizard will assume that "crash" here means that the code
  fails at run-time, and that the code probably fails with an access
  violation (ACCVIO) error.  (When posting, a complete and concise example
  and the exact message(s) received can be quite useful -- otherwise, the
  Wizard must guess at the error and at the problem, and might well guess
  The itemcode argument is passed by reference, not value.
  When the process name and resultant string arguments are not required,
  specify them as zero -- and not as the address of a zero-length constant
  Here is an example of calling lib$getjpi:
#include <jpidef.h>
#include <lib$routines.h>
#include <ssdef.h>
#include <stsdef.h>
  int InputPid, OutputPid, RetStat;
  unsigned short int RetLen;
  InputPid = 0;
  RetStat = lib$getjpi( &JPI$_PID,
                         &RetLen );
  if (!$VMS_STATUS_SUCCESS( RetStat ))
    return RetStat;
  return SS$_NORMAL;

answer written or last revised on ( 12-DEC-2000 )

» close window