[comp.unix.aux] a.out's under MacOS

jsb@panix.UUCP (J. S. B'ach) (02/28/90)

What would it take to run a A/UX binary under MacOS?  What I have in
mind is the opposite of the A/UX 'launch' command, or maybe geting a 
unix executable to run at the push of a Hypercard button?

	-apple!panix!jsb

liam@cs.qmw.ac.uk (William Roberts) (03/01/90)

In article <969@panix.UUCP> jsb@panix.UUCP (J. S. B'ach) writes:
>What would it take to run a A/UX binary under MacOS?  What I have in
>mind is the opposite of the A/UX 'launch' command, or maybe geting a
>unix executable to run at the push of a Hypercard button?

First things first, your A/UX binary would have to use only
MacOS Manager calls and Toolbox calls, because there won't be
an A/UX kernel to handle the normal system calls.

To use A/UX as a cross-compilation system with some local
try-it-and-see capability, you would need an extensively
modified C compiler. The reason is as follows:

A/UX processes run in a virtual address space where the program
always starts at address 0 (or thereabouts) and never has to
live at a different address. MacOS code runs without the aid of
a memory management unit to translate addresses, so must be
prepared to operate no matter what address its code and data
are stored at. This is called *Position Independent Code* and
is mostly done by making all data references use offsets from a
base register (A5 isn't it?).

So you'd need a different C compiler which generates the right
kind of code, and the Unisoft compiler bundled with A/UX won't
do. You could conceivably alter gcc to do this though.

Finally, Mac binaries are organised in a different way which I
don't understand, but which involves collections of small
pieces which are stitched together when the application is
loaded into memory. The best place to start with suitably
compiled code under A/UX is actually the dot-oh files rather
than the linked binaries, and provide a completely different
linker.


I personally believe that this is a worthwhile thing to be able
to do, but it may just happen automatically if and when MPW
works under A/UX. Can anyone from Apple say if having a version
of MPW which runs under A/UX is one someone's list of things to
do in Cupertino, or should we developers try to make some money
here?
-- 

William Roberts                 ARPA: liam@cs.qmw.ac.uk
Queen Mary & Westfield College  UUCP: liam@qmw-cs.UUCP
Mile End Road                   AppleLink: UK0087
LONDON, E1 4NS, UK              Tel:  01-975 5250 (Fax: 01-980 6533)

jsb@panix.UUCP (J. S. B'ach) (03/03/90)

From the reposnes I've gotten, I can see that a.out's won't be running
under A/UX any time soon, but no one adressed the simpler question:
Hypercard runs fine under A/UX.  How about having a way to run
an a.out at the touch of a Hypercard button?  Since A/UX is already
present, this should be possible, no?
-- 
    rutgers!cmcl2!panix!jsb  or less reliably these days, try apple!panix!jsb

"Most feminists aren't married and have no children...They're never going to get
 married, because they can't find a husband...I'm a normal woman." - Ivana Trump

liam@cs.qmw.ac.uk (William Roberts) (03/06/90)

In article <982@panix.UUCP> jsb@panix.UUCP (J. S. B'ach) writes:
>From the reposnes I've gotten, I can see that a.out's won't be running
>under A/UX any time soon, but no one adressed the simpler question:
>Hypercard runs fine under A/UX.  How about having a way to run
>an a.out at the touch of a Hypercard button?  Since A/UX is already
>present, this should be possible, no?

I'm confused now, but what you should have gathered from your
responses is as follows:

1) A/UX compilers produce a.out files which run under A/UX and
   not under MacOS.
2) MPW and co produce Mac binaries that can be run under A/UX
   if they behave themselves, wipe their feet, and are invoked by
   an A/UX utility called "launch"
3) With suitable tinkering, Mac source code can be compiled
   under A/UX and still use the A/UX version of the toolbox.
   Such a.outs don't need to be "launched".


If I understand you correctly, you are asking, "Can I run
HyperCard under A/UX, and at the press of a HyperCard button,
run an A/UX a.out file?". The answer to this is, Yes but...

The "but" is that you can't with A/UX 1.1.1 or below run more
than one Mac application at once, so it should be a non-toolbox
binary (or at the very most, one that uses the NoEvents = 1;
technique to indicate that it doesn't need the Event Manager).

The other "but" is that you will need to write an XCMD (under
MacOS I suspect) which arranges to perform an A/UX system call
to fork a new A/UX process. There are some notes on how to do
this in the A/UX Toolbox Manual, but essentiallyu it amounts to
writing a C program under A/UX, using dis to get the 68000
assembler, converting the A/UX assembler mnemonics into MPW
assembler mnemonics, then compiling the appropriate bits as
routines linked into your XCMD.

Best of luck!
-- 

William Roberts                 ARPA: liam@cs.qmw.ac.uk
Queen Mary & Westfield College  UUCP: liam@qmw-cs.UUCP
Mile End Road                   AppleLink: UK0087
LONDON, E1 4NS, UK              Tel:  01-975 5250 (Fax: 01-980 6533)