From: louis@Barra.COM (Louis Dunne)
Newsgroups: comp.os.vms
Subject: Re: Vax C Executables
Date: 25 Aug 92 18:00:35 GMT
Distribution: world
Organization: BARRA Inc., Berkeley, California.

On Aug 21,  2:29am, "Robert Alan Whitaker, Jr." wrote:
> Subject: Vax C Executables
>Hi,
>
>        I've got another question for you VAX gurus out there:
>
>        Is there any way that I can compile my VAX C programs so that they
>take up less than the minimum of approx. 135 blocks that they take up now?
>
>        The thing that doesn't make sense is that if I compile a program in
>Vax Fortran it only takes up 2 or 3 blocks, whereas a VAX C program takes up a
>minimum of 135 blocks.  If there is some way of getting my C programs down to
>this size, it would be a great help, since we are running in captive accounts
>with only 2000 blocks disk space.
>
>        Thanks in advance,
>
>                                        Robert Alan Whitaker, Jr.
>                                        RW764419@PUCAL.BITNET
>

	Ok, the thing you need to do is to have your programs linked with
	the shareable VAXCRTL libraries, rather than the object libraries.
	What you are doing at the moment, causes the file
	SYS$LIBRARY:VAXCRTL.OLB to be linked with your application. This
	causes the VAX C RTL routines to be sitting right there in your
	application.EXE.

	Rather than do this, make have your application link the 
	SYS$SHARE:VAXCRTL.EXE. To do this have a simple linker options
	file, e.g. place the following in CC_SHARE.OPT:
		SYS$SHARE:VAXCRTL/SHARE
	Then link using the command:
		LINK application.OBJ,CC_SHARE/OPT
	If you need use the /G_FLOAT qualifier you might also want to
	link with SYS$SHARE:VAXCRTLG.EXE. These two files are the only
	shareable versions of the C RTL routines that your normally
	get.

	Having your application link with shareable libraries in this
	way, does not place the code for the C RTL routines withing
	your .EXE. Thus you get the space saving you so desparately
	want :-) Also you get other advantages - for example, you
	don't need to relink you code when a new version of the C RTL
	routines becomes available (possibly to fix a bug etc.).
	The image activator will map those shareable sections at run
	time, depending on the attributes of those sections.

	If your interested in this, a good description of how the image
	activator does this mapping (for different situations) is given ino
	Internals & Data Structures by Goldberg and Kennah (sorry mine's
	at home, I can't give you a page reference, but it's easy to
	find anway!).
	
	Hope this saves your disk space, which you can use for other
	genuine tasks, such as info-vax mail :-)

Louis
        ----------------------------------------------------------------------
       /  Louis Dunne                   /                                   /
      /   VMS/UNIX Systems             /                                   /
     /                                /  Internet:   louis@barra.com      /
    /     BARRA, Inc.                /   Phone:      (510) 649-4229      / 
   /      Suite 400                 /    Fax:        (510) 548-4374     /
  /       1995 University Avenue   /                                   /
 /        Berkeley, CA 94704      /                                   /
----------------------------------------------------------------------

Newsgroups: comp.os.vms