home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / os / vms / 14330 < prev    next >
Encoding:
Internet Message Format  |  1992-08-31  |  3.3 KB

  1. Path: sparky!uunet!gatech!darwin.sura.net!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!ucbvax!lrw.com!leichter
  2. From: leichter@lrw.com (Jerry Leichter)
  3. Newsgroups: comp.os.vms
  4. Subject: RE: Linking C programs
  5. Message-ID: <9208281556.AA13265@uu3.psi.com>
  6. Date: 28 Aug 92 15:46:09 GMT
  7. Sender: usenet@ucbvax.BERKELEY.EDU
  8. Organization: The Internet
  9. Lines: 66
  10.  
  11.  
  12.     I have seen many postings on this list regarding linking a C object
  13.     against the sharable image, VAXCTRL.EXE. This involves creating a
  14.     linker option file (.OPT), and specifying this option file on the
  15.     command line when linking to create a much smaller executable image. I
  16.     have used this method for some time now, and it works quite well...
  17.  
  18.     A short time ago, I saw a response to one of these questions which
  19.     pointed out where the REAL problem is, and why we need to do this in
  20.     the first place.  It was pointed out that since the CRTL wasn't in the
  21.     sharable image library, IMAGELIB.OLB, and therefore, we must provide a
  22.     pointer to it implicitly. Well, why not put it there?? To do this,
  23.     just add it to the image library:
  24.  
  25.             $ SET DEF SYS$LIBRARY
  26.             $ LIB/SHARE IMAGELIB SYS$SHARE:VAXCRTL.EXE
  27.  
  28.     Now you have to remove the logical name pointer to VAXCRTL.OLB. Do a
  29.     SH LOG LNK* <enter>. There will be a reference that looks something
  30.     like this:
  31.  
  32.             LNK$LIBRARY = "SYS$LIBRARY:VAXCRTL"
  33.  
  34.     If you have curses and/or g_float support, it may be LNK$LIBRARY_1 or
  35.     _2.  be sure to DEASS/SYS the logical name that points to VAXCRTL.
  36.     Also, you might also wish to remove/comment out the entry which
  37.     defines it in the startup command procedure so that if the system is
  38.     rebooted, users will not go back to linking against the regular
  39.     library.
  40.  
  41.     If anyone out there might have any comments or warnings on this please
  42.     let me know... As yet, I have not seen/heard of any problems by doing
  43.     this...
  44.  
  45. Periodically, someone proposes this.  Usually, the posting proposing it asks
  46. why, after doing this, C programs fail to work properly.
  47.  
  48. There is an old (day-1) bug in the Linker which makes this fail to work.
  49. I can never remember the exact bug, but the effect it has is that references
  50. to stdin and friends are not resolved consistently:  You end up with multiple
  51. instances of the pre-declared data structures defining the standard input and
  52. output files.  I/O to them will not work correctly.
  53.  
  54. As part of the changeover for the VAX C RTL to the DEC C RTL, I gather this
  55. bug was supposed to finally be fixed.  I seem to recall a vague reference to
  56. a bug fix that sounded as if it could be related in the V5.5 Release Notes.
  57. So it's POSSIBLE that this will work in recent VMS versions.  It definitely
  58. will NOT work in older VMS versions.
  59.  
  60. Of course, the other problem - that you will then have names like "OPEN"
  61. defined in your system-wide copy of IMAGELIB, which may cause all sorts of
  62. amusing problems for programmers in other languages - remains.  DEC C will
  63. presumably do things like:
  64.  
  65.     #define fopen DECC$FOPEN
  66.  
  67. in stdio.h.  ANSI requires that the name "fopen" be meaningful even if stdio.h
  68. isn't included (though such use is discouraged), or the programmer adds
  69.  
  70.     #undef fopen
  71.  
  72. so the problem won't go away completely.  My guess would be that, if you
  73. insist on playing games like this, you'll be stuck with searching some
  74. other library explicitly.
  75.                             -- Jerry
  76.  
  77.