[comp.soft-sys.andrew] porting atk to VMS ?

mai@qt.ipa.fhg.de (Christoph Mai) (11/08/90)

We are thinking 'bout a port of ATK to VMS.

Is this very crazy ? Anybody out there already thought about this ?
Please, VMS gurus, how could we realize dynamic loading in VMS ? Is it
possible at all ?  How to change symbol tables in a VMS object file (makedo) ?

Please comment (FLAMES etc.) via e-mail, i'll summarize.

Thanks in advance,

Christoph.
____________________________________________________________
Christoph Mai (chm@qt.IPA.Fhg.de)
Fraunhofer-Institut f. Produktionstechnik u. Automatisierung
Eierstrasse 46,D-7000 Stuttgart 1

wyant@SABER.COM (11/08/90)

The dynamic loading is probably not the hard part of porting
to VMS. VMS actually has a callable dynamic loader, in the form
of the 'lib_$find_symbol' library call. This call takes an object file
name and a symbol name. It loads the object file and returns a pointer
to the given symbol (if present).  For an example of layer ATK on top
of an existing dynamic loader look at the Apollo specific code, which
uses the existing Apollo/Domain-OS dynamic loader.

My guess as to what will be hardest to do is asynchronous I/O handling
(read select). Since, last time I looked, VMS didn't provide a select
as part of their C Library, you'll have to dummy up your own (using
event flags I guess). The other problems that you encounter will probably
have to do with terminal IO (setting PTY characteristics), and differences
in signal handling.

I don't think its an entirely crazy idea. Did'nt someone at IBM do a trial
port to OS/2 ? So in theory it is possible to port away from Unix.

-- Geoff Wyant
wyant@saber.com

guy@auspex.auspex.com (Guy Harris) (11/09/90)

 >The dynamic loading is probably not the hard part of porting
 >to VMS. VMS actually has a callable dynamic loader, in the form
 >of the 'lib_$find_symbol' library call. This call takes an object file
 >name and a symbol name. It loads the object file and returns a pointer
 >to the given symbol (if present).  For an example of layer ATK on top
 >of an existing dynamic loader look at the Apollo specific code, which
 >uses the existing Apollo/Domain-OS dynamic loader.

Or the IBM RISC System/6000 dynamic loader, which uses the existing AIX
3.1 dynamic loader.

Bear in mind, though, that both those schemes depend on the ability to
mark a particular symbol in the dynamically loaded file as
"distinguished" by making it the "entry point symbol"; I don't know if
the VMS dynamic loader has this facility, but the SunOS 4.1/System V
Release 4 dynamic loader does *not*, as far as I know, so you may have
to look up that symbol explicitly.  The way that seemed to work in my
cobbled-up prototype for SunOS 4.1/S5R4 is to do:

	/*
	 * Construct name of GetClassInfo symbol from the package name
	 * by stripping off the suffix and appending "__GetClassInfo".
	 * You can't get the entry point value from a shareable object
	 * from the "dl*()" routines, which is why we have to do this
	 * stuff.
	 * We strip off the suffix because "doindex", curse its soul,
	 * hands us the last component of the name of the *file* as
	 * the package name, suffix and all.
	 */
	(void) strcpy(epname, name);
	p = strrchr(epname, '.');
	if (p == NULL)
		p = epname + strlen(epname);
	(void) strcpy(p, "__GetClassInfo");

to construct the name of the symbol in question.  "name" is the second
argument to "doload".  The "path" (fifth) argument is the actual
pathname of the file to be loaded.

Note also that you will have to ensure that some symbols in the "class"
loader code are accessible to the dynamic loader, as the
dynamically-loaded object may refer to them (e.g.,
"class_RoutineStruct").  This appears to require varying amounts of
hackery on Domain/OS and AIX 3.1, and also requires hackery in SunOS
4.1/S5R4:

	in Domain/OS, "doload()" explicilty calls the loader to add them
	to the Known Global Table;

	in AIX 3.1, the "class" loader ".o" files are linked together
	into a single ".o" file and the linker is explicitly told to
	export them;

	in SunOS 4.1 and (probably) S5R4, the best or maybe even only
	way to do so is to make "libclass.a" into a *shared* library.

(No, the prototype doesn't really "work" - I hand-built pieces of it
instead of changing the Imakefiles, and I've only tested it with the
stuff in the "overhead/class/testing" directory, not with ATK itself. 
I've no idea when I'll do anything further on it, and there are some
unresolved issues waiting some responses to mail I sent out....)