Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ncar!gatech!udel!mmdf From: gay%elde.epfl.ch@cunyvm.cuny.edu (David Gay) Newsgroups: comp.sys.amiga Subject: Re: Linking without startup code or libraries Message-ID: <10179@louie.udel.EDU> Date: 5 Mar 89 00:55:13 GMT Sender: mmdf@udel.EDU Lines: 39 >/* hello.c */ >#include >#include > >struct DosLibrary *DOSBase; >static char msg[]="Hello, world!\n"; > >void main() >{ > DOSBase=(struct DosLibrary *) OpenLibrary("dos.library",0); > Write(Output(),msg,sizeof(msg)); > CloseLibrary((struct Library *) DOSBase); >} >----- >lc -b -r -v hello.c >blink hello.o to hello smallcode smalldata The problem is that A4 (which points to global data) is not initialised. 2 solutions: - compile with lc -b0 -v hello.c - add a call to geta4() at the start of main() (if you include , this will be expanded "inline"). >Deven >-- >------- shadow@pawl.rpi.edu ------- Deven Thomas Corzine --------------------- >Cogito shadow@acm.rpi.edu 2346 15th Street Pi-Rho America >ergo userfxb6@rpitsmts.bitnet Troy, NY 12180-2306 (518) 272-5847 >sum... In the immortal words of Socrates: "I drank what?" ...I think. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ David Gay 6 x 9 = 42 GAY@ELDE.EPFL.CH, or GAY%ELDE.EPFL.CH@CLSEPF51.bitnet ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~