[comp.sys.amiga.tech] Lattice C V5.0 hello.c -- 132 byte executable

deven@rpi.edu (Deven T. Corzine) (04/12/90)

For the curious, and for an example of a simple program for Lattice
which requires no startup code, here is a "Hello, world!" program
highly optimized for the Amiga environment...  The idea for the
"execute to compile" trick came from "avail.c" in the Examples
directory on Lattice disk 4.  That program is an excellent source of
neat tricks you won't find in the manual...

-- hello.c ------------- [cut here] --------------------------------
; /* execute to compile
lc -v -j73 -cus hello.c
blink hello.o to hello sc sd nd
delete hello.o
protect hello +p
quit
*/

#include <proto/exec.h>
#include <proto/dos.h>
#define MSG "Hello, world!\n"

main()
{
   struct DosLibrary *DOSBase;

   if (!(DOSBase=(struct DosLibrary *) OpenLibrary(DOSNAME,0))) return(1);
   Write(Output(),MSG,sizeof(MSG));
   CloseLibrary((struct Library *) DOSBase);
   return(0);
}
-- 
Deven T. Corzine        Internet:  deven@rpi.edu, shadow@pawl.rpi.edu
Snail:  2151 12th St. Apt. 4, Troy, NY 12180   Phone:  (518) 274-0327
Bitnet:  deven@rpitsmts, userfxb6@rpitsmts     UUCP:  uunet!rpi!deven
Simple things should be simple and complex things should be possible.