From:	CRDGW2::CRDGW2::MRGATE::"SMTP::CRVAX.SRI.COM::RELAY-INFO-VAX" 19-JUN-1989 22:42
To:	MRGATE::"ARISIA::EVERHART"
Subj:	Re: How do I create a Callable Interface to a utility?

Received: From KL.SRI.COM by CRVAX.SRI.COM with TCP; Mon, 19 JUN 89 18:16:08 PDT
Received: from hac2arpa.hac.com by KL.SRI.COM with TCP; Mon, 19 Jun 89 18:12:06 PDT
Received: from [128.152.60.5] by hac2arpa.hac.com (5.59/SMI-DDN)
	id AA18240; Mon, 19 Jun 89 18:13:39 PDT
Received: by draco id <2020025C881@draco.HAC.COM> ;
       Mon, 19 Jun 89 18:13:08 PDT
Date: Mon, 19 Jun 89 18:13:04 PDT
From: Mike Kimura <MNK@draco.hac.com>
Subject: Re: How do I create a Callable Interface to a utility?
To: info-vax%kl.sri.com@hac2arpa.hac.com,
        bsu-cs!cfchiesa%uunet.uu.net@hac2arpa.hac.com
X-Vms-Mail-To: EXOS%"<info-vax%kl.sri.com@hac2arpa>",EXOS%"<bsu-cs!cfchiesa%uunet.uu.net@hac2arpa>"
Message-Id: <890619181304.2020025C881@draco.HAC.COM>

Matt Madison (as well as "gjc" and David L. Stevens) correctly responded to
Chris Chiesa's question on "How do I create a Callable Interface to a
utility?" There are a number of things to beware of in trying to use and/or
develop a callable editor.

      o MAIL interprets the string CALLABLE_xxx defined for MAIL$EDIT to
	mean activate the shareable image xxxSHR and call xxx$EDIT in this
	image.  The symbol xxx$EDIT is found and the image activated via
	LIB$FIND_IMAGE_SYMBOL.  The SET EDITOR command in VMS MAIL assumes
	you are refering to a callable editor.  Callable editors are also
	used by VAX Notes.

      o By the way, a little known fact is that TECO is also a callable
	editor!!!  ACLEDIT is also callable (not very useful for MAIL
	though) but the shareable image is named ACLEDTSHR.EXE (not
	ACLEDITSHR.EXE and so MAIL won't find it.

      o The xxx$EDIT symbol in the shareable image must be declared to the
	linker to be a "Universal" symbol and the code should all be PIC
	(Position Independent Code).  The xxx$EDIT should take two
	parameters by descriptor, namely the input and output file
	specifications.  Also xxx$EDIT needs to return a valid status value.

      o The shareable image xxxSHR is found by first attempting to translate
	the logical name xxxSHR and then by applying the default file
	specification of SYS$SHARE:.EXE to xxxSHR.  Therefore, either your
	shareable image needs to reside in SYS$SHARE or you have to define a
	logical name xxxSHR to point to it.

      o If the calling image is installed with privilege (as is VMS MAIL)
	then the xxxSHR logical name, if used, must be defined in Exec mode
	in the System logical name table AND the shareable image must be
	installed as a known image.  This is a problem with trying to use
	TECO as your editor for mail because TECOSHR.EXE is not installed by
	default (i.e.  it is not listed in VMSIMAGES.DAT).  TECO works fine
	as a callable editor for VAX Notes since VAX Notes is not installed
	with privilege.

      o By far the toughest problem is that described by "gjc" which is that
	your data structures are not re-initialized the next time xxx$EDIT
	is called and so you can not rely on compiler generated
	initializations (or demand zero initialization).  You must
	re-initialize ALL data structures the next time xxx$EDIT is called.

----------------------------------------------------------------------------
Michael Kimura			Internet:	mnk@draco.hac.com
Hughes Aircraft Company (RSG)	BITnet:		mnk@draco.hac.com
P.O. Box 92426	  MS: R2/A159	EDEN:		draco::mnk
Los Angeles,  CA  90009		Telephone:	(213) 615-9775
----------------------------------------------------------------------------

