Article 127076 of comp.os.vms:
Path: nntpd.lkg.dec.com!btgmax.zko.dec.com!whitman
From: whitman@btgmax.zko.dec.com (Sandra Whitman)
Newsgroups: comp.os.vms
Subject: Re: Undefined symbols: DECC$GA_SYS_ERRLIST etc.?
Date: 15 Aug 1995 14:36:43 GMT
Organization: Digital Equipment Corporation
Lines: 203
Distribution: world
Message-ID: <40qbdr$ba5@nntpd.lkg.dec.com>
References: <1995Aug9.161839@axp.psl.ku.dk> <1995Aug9.175603.1@sldb5.slac.stanford.edu> <DD3nK0.ELK@plato.ds.boeing.com>
Reply-To: whitman@tle.enet.dec.com
NNTP-Posting-Host: btgmax.zko.dec.com
X-Newsreader: mxrn 6.18-9


In article <DD3nK0.ELK@plato.ds.boeing.com>, nickerson@mirage.boeing.com () writes:
|>
|>In article <1995Aug9.175603.1@sldb5.slac.stanford.edu>, fairfield@sldb5.slac.stanford.edu writes:
|>|>In article <1995Aug9.161839@axp.psl.ku.dk>, 
|>|>    		lejf@axp.psl.ku.dk (Lejf Rasmussen, Psyk. Lab. K.U.A.) writes:
|>|>
|>|>> 	On linking mxrn (x-window news reader) on OpenVMS 6.1
|>|>> with DECC 4.1, I get 2 undefined symbols:
|>|>> 
|>|>> 	DECC$GA_SYS_ERRLIST and
|>|>> 	DECC$GL_SYS_NERR
|>|>> 
|>|>> 	The mxrn.exe produced appears to work, except for an
|>|>> access violation on exit.
|>|>> Anyone, who can tell me to get rid of these undefined symbols?
|>|>[...]
|>|>
|>|>        Interestingly enough, there is a DSNlink article addressing what
|>|>    sounds like _almost_ the same problem, and suggesting a work-around.
|>|>    However, that article references OpenVMS/Alpha  V6.2, not V6.1.  The
|>|>    analysis  seems  to  suggest that the symbols _used_  to  be  (bare,
|>|>    unprefixed)   SYS_ERRLIST   and   SYS_NERR,   were   removed    from
|>|>    SYS$LIBRARY:STARLET.OLB  in  V6.2,  and  _should_ have been replaced
|>|>    with DECC$ prefixed versions.   [There's more to it thatn that, but
|>|>    you get the idea...]  
|>|>
|>|>        The DSNlink article is  in  the  DEC  C  database and is titled,
|>|>    "%LINK-I-UDFSYM, SYS_ERRLIST %LINK-I-UDFSYM, SYS_NERR".
|>|>
|>|>        -Ken
|>|>-- 
|>|> Kenneth H. Fairfield       |  Internet: Fairfield@Slac.Stanford.Edu
|>|> SLAC, P.O.Box 4349, MS 46  |  DECnet:   45537::FAIRFIELD (45537=SLACVX)
|>|> Stanford, CA   94309       |  Voice:    415-926-2924    FAX: 415-926-3515
|>|> -------------------------------------------------------------------------
|>|> These opinions are mine, not SLAC's, Stanford's, nor the DOE's...
|>|>
|>
|>in linking mxrn 6.18-32 
|>	AXP, OpenVMS 6.1, DEC C 5.0 == not a problem
|>	VAX, OpenVMS 6.1, DEC C 5.0 == have a problem as shown below
|>
|>%LINK-E-OUTSIMG, attempted store location %X00000A44 is outside image binary (%X
|>00000000 to %X00000000)
|>        in psect SYS_ERRLIST module XRN file ...
|>
|>the relevant list expansion at an include of perror.h shows:
|>
|>37360      I2	#if __VMS_VER >= 60200000
|>37361   X  I2	#if defined(__DECCXX) || defined(__DECC)
|>37362   X  I2	# pragma __extern_model __save
|>37363   X  I2	# pragma __extern_model __relaxed_refdef
|>37364   X  I2	#define sys_nerr decc$gl_sys_nerr
|>37365   X  I2	#define sys_errlist decc$ga_sys_errlist
|>37366   X  I2	  extern int decc$gl_sys_nerr;
|>37367   X  I2	  extern  char **decc$ga_sys_errlist;
|>37368   X  I2	# pragma __extern_model __restore
|>37369   X  I2	#else 
|>37370   X  I2	  extern noshare int sys_nerr;
|>37371   X  I2	  extern noshare char *sys_errlist[];
|>37372   X  I2	#endif
|>37373   X  I2	#else
|>37374      I2	/* sys_nerr and sys_errlist are implemented 
|>37375      I2	 * as of OpenVMS V6.2.
|>37376      I2	 */
|>37377      I2	# pragma __extern_model __save
|>37378      I2	# pragma __extern_model __common_block
|>37379      I2	 extern char *sys_errlist[] = {"",0};
|>37380      I2	 extern int sys_nerr = 0;
|>37381      I2	# pragma __extern_model __restore
|>37382      I2	#endif
|>
|>I have no fix; it seems that the test of vms 6.2 allows no alternate
|>compile method with /noprefix or whatever
|>
|>Bart Nickerson
|>nickerson@mirage.boeing.com
|>(206) 662-0183
|>

Unfortunately there were some bugs in the DEC C Version 5.0
and 4.1 perror.h.  In order to correct them you will have to extract 
perror.h from sys$library:decc$rtldef.tlb, edit the file and 
then reinsert it back into sys$library:decc$rtldef.tlb.

If you ever reinstall DEC C Version 5.0 or 4.1, you will need
to repeat these steps, so that you will always use the
edited version of perror.h.

We apologize for any inconvenience these bugs have caused.

In order to correct perror.h you must do the following:

1.  Extract the DEC C Version 5.0 or 4.1 perror.h from
    sys$library:decc$rtldef.tlb.  You might want to save
    this header for future reference. 

    $library/extract=perror/out=save_v50_perror.h sys$library:decc$rtldef.tlb


2.  Copy save_v50_perror.h to perror.h.  Edit perror.h such that
    neither sys_nerr nor sys_errlist are initialized on 
    pre-OpenVMS Version 6.2 systems.  A fully edited version of
    perror.h is included at the end of these steps.

    Your edit will replace:

        #else
	/* sys_nerr and sys_errlist are implemented 
	 * as of OpenVMS V6.2.
	 */
	# pragma __extern_model __save
	# pragma __extern_model __common_block
	 extern char *sys_errlist[] = {"",0};
	 extern int sys_nerr = 0;
	# pragma __extern_model __restore
	#endif

    with:

        #else
	/* sys_nerr and sys_errlist are implemented 
	 * as of OpenVMS V6.2.
	 */
	# pragma __extern_model __save
	# pragma __extern_model __common_block
	 extern char *sys_errlist[];
	 extern int sys_nerr;
	# pragma __extern_model __restore
	#endif

3.  Replace your edited version of perror.h back into 
    sys$library:decc$rtldef.tlb.  

    $library/replace sys$library:decc$rtldef.tlb perror.h
    

The fully edited version of perror.h is listed here:

#ifndef __PERROR_LOADED
#define __PERROR_LOADED	1

/*  
 *  <perror.h> - error message variables 
 *
 *  Copyright (c) 1994 by Digital Equipment Corporation.  All rights reserved.
 *
 *  DEC C for OpenVMS VAX and OpenVMS AXP
 *  DEC C++ for OpenVMS VAX and OpenVMS AXP
 */

#if defined(__DECC) || defined(__DECCXX)
#pragma __nostandard  /* This file uses non-ANSI-Standard features */
#else
#pragma nostandard
#endif

#ifdef __cplusplus
    extern "C" {
#endif

#if __VMS_VER >= 60200000
#if defined(__DECCXX) || defined(__DECC)
# pragma __extern_model __save
# pragma __extern_model __relaxed_refdef
#define sys_nerr decc$gl_sys_nerr
#define sys_errlist decc$ga_sys_errlist
  extern int decc$gl_sys_nerr;
  extern  char **decc$ga_sys_errlist;
# pragma __extern_model __restore
#else 
  extern noshare int sys_nerr;
  extern noshare char *sys_errlist[];
#endif
#else
/* sys_nerr and sys_errlist are implemented 
 * as of OpenVMS V6.2.
 */
# pragma __extern_model __save
# pragma __extern_model __common_block
 extern char *sys_errlist[];
 extern int sys_nerr;
# pragma __extern_model __restore
#endif

#ifdef __cplusplus
    }
#endif

#if defined(__DECC) || defined(__DECCXX)
#pragma __standard  /* This file uses non-ANSI-Standard features */
#else
#pragma standard
#endif

#endif					/* __PERROR_LOADED */

-- 
Sandra Whitman, ZK2-3/N30			Whitman@tle.enet.dec.com
Digital Equipment Corporation			decwrl!tle!whitman
110 Spit Brook Rd,
Nashua, NH 03062


