rlcarr@athena.mit.edu (Rich Carreiro) (02/19/89)
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 * *******************************************************************************