From: marshall@force.ssd.lmsc.lockheed.com (Bob Marshall)
Subject: Re: Help with local command for c link
Reply-To: marshall@force.ssd.lmsc.lockheed.com
Organization: LMSC, Sunnyvale, California
Date: Thu, 20 Aug 92 19:44:49 GMT

In article <1992Aug19.153249.1@slacvx.slac.stanford.edu>, fairfield@slacvx.slac.stanford.edu writes:
>In article <sjs.714254270@sbphy.physics.ucsb.edu>, sjs@sbphy.physics.ucsb.edu (Steve J. Schmidhauser) writes:
>> I am having problems trying to create a local command so that the c
>> linker will use the shared libraries. We used to use a batch link inside
>> a captive account. I am trying to give students more access to dcl but
>> would like the link command to default to the shared libraries to save
>> disk space. This is what I tried to do and the results:
>> 
>> $ lin*k    :== $LINK/NOMAP 'P1'  , DISK$UTIL:[MACRO]OPTIONS_FILE/OPT
>> (from login.com for c students) and this is what happens
>> 
>> $ link perf4
>> %CLI-F-SYNTAX, error parsing 'TRACE'
>> -CLI-E-ENTNF, specified entity not found in command tables
>
>    Close, but you can't use the 'P1' in a DCL symbol as you've attempted:
>it gets evaluated at symbol definition time.  Not to worry, do the following
>in the students' LOGIN.COM:
>
>	$ LIN*K == "@DISK$UTIL:[MACRO]LINK.COM"
>
>Then have LINK.COM include whatever was in OPTIONS_FILE.OPT like so:
>
>LINK.COM:
>--------
>	$ LINK/NOMAP 'P1',SYS$INPUT:/OPT
>	  DISK$UTIL:[SOMEDIR]SOMEIMAGE/SHARE
>	  VAXCRTL/SHARE
>        $ EXIT
>

Well, this isn't quite right either. Although there are probably better ways
to accomplish the whole task (which isn't well-described in the first place),
the technique mentioned above has a couple of minor flaws :

1. It doesn't work.
2. The reason it doesn't work is that the global symbol LINK is still
   defined when LINK.COM executes. So LINK/NOMAP equates to
   @DISK$UTIL:[MACRO]LINK.COM/NOMAP, which fails right off the bat
   since /NOMAP is not a valid qualifier for the "@" command. Even it
   it did get past that, you would quickly find that you hit the 32-level
   limit for nesting command procedures, since the command procedure would
   be recursively executed. So, the first line of the procedure should
   be "$ SET SYMBOL/SCOPE=(NOGLOBAL)"
3. OK, we've added the SET SYMBOL command at the top. The next problem is
   that it does not allow the users to specify any qualifiers on the
   LINK command (maybe the original poster didn't want them to; it's 
   unclear). For example, LINK/NOTRACE would result in 
   @DISK$UTIL:[MACRO]LINK.COM/NOTRACE, once again resulting in an error
   since /NOTRACE is not a valid qualifier for the "@" command. The way
   I have usually gotten around this is to do something like this :

     $ LIN*K == "@DISK$UTIL:[MACRO]LINK %"

   Note the "%" sign.

   Then LINK.COM would look like this :

     $ set symbol/scope=(noglobal)
     $ stuff = p2+" "+p3+" " +p4+" "+p5+" "+p6+" "+p7+" "+p8
     $ link/nomap 'stuff',sys$input:/opt
	  disk$util:[somedir]someimage/share
	  vaxcrtl/share
     $ exit
   
   Then p1 contains "%", which is discarded.

   Note that this also gets around the last shortcoming of your technique,
   i.e., it only allowed one input parameter, P1.

Note that the original error message that the poster was referring to had
nothing to do with the error of specifying "P1" in the definition of
LIN*K. That error had to do with the "$" that was in front of "LINK" on
the right side of the definition. That creates a foreign command and the
CLD for the DCL LINK verb goes right out the window.

=============================================================================
Bob Marshall                     \\     "It ain't age
Lockheed Missiles & Space Co.     \\     That makes me look this way
Sunnyvale, CA                      \\    It ain't the years, boys,
marshall@force.ssd.lmsc.lockheed.com\\   It's the miles"
"I tell the truth 'cept when I lie"  \\     - Chris LeDoux
=============================================================================
Newsgroups: comp.os.vms