🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.amiga.tech
Article #11462

Lattice startup code questions

#11462
From: Rich Carreiro
Date: Sat, 18 Feb 1989 22:08
82 lines
3329 bytes
I have some questions about C startup code - what exactly does it have
to do?  I waslooking through the KICKSTART GUIDE TO THE AMIGA and saw the
following:

/* OurStart.c - simple startup code */
#include <exec/types.h>
#define KNOWN_ADDRESS 4

extern APTR OpenLibrary();
extern VOID CloseLibrary();

APTR SysBase;
APTR DOSBase;

OurStart()
{
   SysBase = *((APTR *) KNOWN_ADDRESS);
   DOSBase = OpenLibrary("dos.library",0);

   main();
   CloseLibrary(DOSBase);
}

and to be used with it:

/* beep.c - link with ourstart.o */
#include <exec/types.h>

extern APTR OpenLibrary();
extern VOID CloseLibrary(), DisplayBeep();

APTR IntuitionBase;

main()
{
   int i;

   IntuitionBase = OpenLibrary("intuition.library",29);

   if (IntuitionBase != 0) {

      for (i=0;i<6;i++) {
	DisplayBeep();
        Delay(5);
      }
   CloseLibrary(IntuitionBase);
   }
}

I compile each with 'lc -v filename' and they compile fine.  I next do
'blink from ourstart.o+beep.o to beep lib lib:amiga.lib' [I have
Latice 5.02]  and it links fine.  When I run it, instant Guru 4.  When
I recompile with debug information and do a 
'blink from ourstart.o+beep.o to beep lib lib:amiga.lib addsym' and
to a 'cpr beep' cpr comes up, displays the source starting at OurStart(), 
not main(), and then locks up.  I can move slider bars and MachII keeps working
but cpr won't respond to anything.  Note that beep.c works fine if I link
it with c.o, lc.lib, and amiga.lib.  Also, when I link with ourstart.o, cpr
reports that beep has 2 modules, while if I link with c.o et al., cpr says
there is only one module.  I have looked through c.a to get an idea of what
it is doing, but I don't know assembly.

Finally, all the books on C pertaining to the Amiga talk about linking
with the AStartup.obj and LStartup.obj startup codes.  I have gathered
that LStartup.obj is now c.o and is used when you want Lattice library
(lc.lib) I/O.  Astartup.obj was used when you didn't care about UNIX
commend line emulation and wanted Amiga, not lattice I/O - in this
even you also linked amiga.lib AHEAD of lc.lib.  My question is - with
Lattice 5.02, what is the equivalent of Astartup.obj?

Any answers, comments, corrections to any of this will be more than
appreciated.

ARPA:    rlcarr@athena.mit.edu
UUCP:    {wherever}!mit-eddie!mit-athena!rlcarr
BITNET:  rlcarr%athena.mit.edu@MITVMA.mit.edu

*******************************************************************************
* Rich Carreiro                 "Back off man, I'm a scientist."              *
* rlcarr@athena.mit.edu                - Dr. Peter Venkman                    *
*******************************************************************************
Technical Details
Message-ID: <9322@bloom-beacon.MIT.EDU>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!bloom-beacon!athena.mit.edu!rlcarr

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!bloom-beacon!athena.mit.edu!rlcarr
From: rlcarr@athena.mit.edu (Rich Carreiro)
Newsgroups: comp.sys.amiga.tech,comp.sys.amiga
Subject: Lattice startup code questions
Summary: how small can I make it
Keywords: C Startup small how?
Message-ID: <9322@bloom-beacon.MIT.EDU>
Date: 18 Feb 89 22:08:30 GMT
Sender: daemon@bloom-beacon.MIT.EDU
Reply-To: rlcarr@athena.mit.edu (Rich Carreiro)
Followup-To: comp.sys.amiga.tech
Organization: Massachusetts Institute of Technology
Lines: 82