Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!gem.mps.ohio-state.edu!ginosko!aplcen!haven!uvaarpa!mcnc!rti!sas!walker
From: walker@sas.UUCP (Doug Walker)
Newsgroups: comp.sys.amiga.tech
Subject: Re: Help.  Lattice & UnHunk
Message-ID: <1252@sas.UUCP>
Date: 28 Sep 89 15:09:43 GMT
References: <1602@tellab5.tellabs.CHI.IL.US>
Reply-To: walker@sas.UUCP (Doug Walker)
Distribution: na
Organization: SAS Institute Inc, Cary NC
Lines: 27

>I compile with "lc -L test.c", and I use UNHUNK as "unhunk -p test test.out".
>UNHUNK generates the following :
...
>Data Hunk size 63 doesn't match header (217)
>
>Why is the output so long, I would think that test.c would be less than 
>100 bytes (I compiled the same test.c with UNI-WARE on a VAX and the output
>was around 45 bytes).

You are linking with the Lattice-supplied startup code (c.o), which is
linking in everything you need to do stdio calls, opening dos.library,
defining externs and everything else.  You need to get rid of the -L on
the command line and issue the BLINK command yourself without the startup.

The reason unhunk gets the error is that apparently it doesn't support
suppressed BSS data.  BLink is combining the data and BSS hunks into a
single data hunk, but not putting actual data in for the BSS (since it
is initialized to 0 anyway).

If you get rid of c.o, it will reduce your code size to the order you
expect.  BLink will also not combine the hunks, solving your other
problem.  You need to be aware that you are responsible for opening
dos.library, and you can't use ANY function calls except those in the 
standard amiga libraries - exec, dos, whatever else you open.  This means
NO PRINTF, NO MALLOC, NO FGETS.

--Doug