Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ulowell!cbmvax!jesup From: jesup@cbmvax.UUCP (Randell Jesup) Newsgroups: comp.sys.amiga.tech Subject: Re: Lattice startup code questions Keywords: C Startup small how? Message-ID: <6054@cbmvax.UUCP> Date: 22 Feb 89 22:00:03 GMT References: <9322@bloom-beacon.MIT.EDU> <90452@sun.uucp> Reply-To: jesup@cbmvax.UUCP (Randell Jesup) Organization: Commodore Technology, West Chester, PA Lines: 36 In article <90452@sun.uucp> cmcmanis@sun.UUCP (Chuck McManis) writes: >In article <9322@bloom-beacon.MIT.EDU> (Rich Carreiro) writes: > >>I have some questions about C startup code - what exactly does it have >>to do? >closing those libraries as well. In Lattice's case they also take care >of handling the workbench startup message you get sent when the user >double-clicks on an icon that activates your program. It also sets up A4 to point to the merged data area, unless you compile everything with -b0. This is very important - look in the lattice c.a file for more info. _main.c will have the rest of the startup stuff (where it actually calls main()). >My guess is that your code never manages to open Intuition, falls out >the bottom of main with an undefined value, and falls out of your startup >code into uninitialized memory. At some point you have to call Exit() to >get back to your original CLI. Please, use exit() or equivalent (XCEXIT in lattice c.a) instead of Exit(). Exit is really more for BCPL, and with most compilers you should call a cleanup routine. Look at c.a, once again. >Well, Carolyn Scheppner put a bunch of startup modules on BIX and on >a Fish disk I believe. These were TWStartup et al. They are the what >{A|L}Startup.obj became. Generally, with the 5.0 libcall stuff and >and judicious programming you can link with _no_ libraries and get >a really tight executable. Once again, be careful of the A4 stuff, or compile everything with -b0. Or you can modify twstartup to do c.a stuff, or modify c.a to do twstartup stuff. -- Randell Jesup, Commodore Engineering {uunet|rutgers|allegra}!cbmvax!jesup