[Info-vax] $sndopr() and dsc64$descriptor

Jim mckinneyj at leidos.com
Thu Mar 11 13:32:07 EST 2021


On Thursday, March 11, 2021 at 10:06:36 AM UTC-5, Jim wrote:
> Anyone know if $sndopr should accept a 64 bit descriptor describing its 
> msgbuf argument? Or is $sndopr 32 bit only? 
> 
> Environment is VMS V8.4.-1H1; C program compiled with /pointer_size=64...

In case anyone else is wandering down this path, below is one way
to deal with 32 bit system services in a 64 bit world by placing or
copying the relevant data into 32 bit space.

/*
$ cc/pointer_size=64 test_sndopr_64
$ link test_sndopr_64
*/

#define __NEW_STARLET 1

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <descrip.h>
#include <opcdef.h>
#include <ssdef.h>
#include <stsdef.h>
#include <starlet.h>

int main (void)
{
static int r0;
static unsigned short int length;

char message[] = "Test $sndopr() from 64 bit program";

#if __INITIAL_POINTER_SIZE == 64
# pragma __pointer_size __save 
# pragma __pointer_size 32
#endif

static OPCDEF reply;
static struct dsc$descriptor_s reply_dsc;

#if __INITIAL_POINTER_SIZE == 64
# pragma __pointer_size __restore
#endif

reply.opc$b_ms_type = OPC$_RQ_RQST;
reply.opc$b_ms_target = OPC$M_NM_CENTRL;
reply.opc$l_ms_rqstid = 0;
_strcpy32((__char_ptr32)&reply.opc$l_ms_text, message);

length = strlen((__char_ptr32)&reply.opc$l_ms_text);

reply_dsc.dsc$b_dtype = DSC$K_DTYPE_T;
reply_dsc.dsc$b_class = DSC$K_CLASS_S;
reply_dsc.dsc$a_pointer = (__char_ptr32)&reply;
reply_dsc.dsc$w_length = length + 8;

r0 = sys$sndopr (&reply_dsc, 0);
if (!$VMS_STATUS_SUCCESS(r0)) return r0;
}



More information about the Info-vax mailing list