From:	SMTP%"RELAY-INFO-VAX@CRVAX.SRI.COM" 14-JUN-1993 12:26:17.68
To:	EVERHART
CC:	
Subj:	Re: How do you set symbolic names using VAX C?

Date: Sun, 13 Jun 1993 15:38:44 +0100
From: Arne Vajhoej <ARNE@kopc.hhs.dk>
Subject: Re: How do you set symbolic names using VAX C?
To: stevec@WREN.INMOS.CO.UK, INFO-VAX@SRI.COM
Message-id: <01GZC29UK1PU9GVDTD@kopc.hhs.dk>
X-VMS-To: KOPC::IN%"stevec@WREN.INMOS.CO.UK"
X-VMS-Cc: IN::"INFO-VAX@SRI.COM"
MIME-version: 1.0
Content-type: TEXT/PLAIN; CHARSET=ISO-8859-1
Content-transfer-encoding: 8BIT

> Could somebody point me at some VAX C code to read and set symbolic names?
> 
> I would like to do the equivalent of the following DCL, but from within a
> C program :
> 
> $ IBOARDSIZE :== #200000

I think the following small example shows how to do it:

#include <stdio.h>
#include <string.h>
#include <libclidef.h>
#include <descrip.h>

int lib$set_symbol();
int lib$get_symbol();

main()
{
   long globsym = LIB$K_CLI_GLOBAL_SYM;
   $DESCRIPTOR(nmdesc,"TSTSYM");
   char tstval[] = "This is a test value";
   short vallen;
   char val[256];
   $DESCRIPTOR(valdesc,val);
   strcpy(valdesc.dsc$a_pointer,tstval);
   valdesc.dsc$w_length = strlen(tstval);
   lib$set_symbol(&nmdesc,&valdesc,&globsym);
   valdesc.dsc$w_length = sizeof(val) - 1;
   lib$get_symbol(&nmdesc,&valdesc,&vallen,&globsym);
   val[vallen] = '\0';
   printf("TSTSYM = %s\n",val);
}

Hope it helps !

                                                          Arne

Arne Vajhøj                             local DECNET:  KO::ARNE
Computer Department                     PSI:           PSI%238310013040::ARNE
Business School of Southern Denmark     Internet:      ARNE@KO.HHS.DK


