Path: utzoo!mnetor!tmsoft!torsqnt!news-server.csri.toronto.edu!cs.utexas.edu!uunet!elroy.jpl.nasa.gov!lll-winken!ames!uhccux!munnari.oz.au!uniwa!vax7!nlewispn From: Lewis_P@cc.curtin.edu.au (Peter Lewis) Newsgroups: comp.sys.mac.programmer Subject: Re: Cross Compilers for Mac ? Message-ID: <7130.27bfdc02@cc.curtin.edu.au> Date: 18 Feb 91 05:52:02 GMT References: Organization: Curtin University of Technology Lines: 51 In article , nv89-nun@alv.nada.kth.se (Nicklas Ungman) writes: > I'we also been thinking of doing some cross developing in the Mac. One way > to cross compile is to build a stand-alone code resource. This can be done > with both MPW C and THINK C, which are both good compilers. However, this > prevents you from using global variables, and also limits multi segmentation. This is how we programmed a standalone 68000 for a micro-mouse competition (albeit using THINK Pascal, but its basically the same). Another problem was that you had to be very careful about what you called, and how the libraries worked (the silly thing crashed with and A-line trap, and it took us a while to find that my co-programmer (who shall remain nameless - Hi John :-) had foolishly called Random). > Does anyone know how to get around this problem? The way we solved this was to allocated a fixed space on the target machine for globals - say $1000 bytes at $00400000, then do - const globals=$00400000; type gr=record any globals you want end; gp=^gr; Then at the start of any procedure requiring global variables - var g:gp; begin g:=gp(globals); with g^ do begin .... end; end; Its not particularly elegant, but it works ok. If you dont want to allocate a huge block of ram, you could just allocate a fixed pointer, and use g^^. Saddly, with C, you cant use nested procedures to mimic globals (it wouldnt work very well with large projects anyway). > > /Nixxon HTH, Peter. -- Disclaimer:Curtin & I have an agreement:Neither of us listen to either of us. *-------+---------+---------+---------+---------+---------+---------+-------* Internet: Lewis_P@cc.curtin.edu.au I Peter Lewis Bitnet: Lewis_P%cc.curtin.edu.au@cunyvm.bitnet I NCRPDA, Curtin University UUCP: uunet!munnari.oz!cc.curtin.edu.au!Lewis_P I GPO Box U1987 AppleLink: Guy Kawasaki for Apple President! I Perth, WA, 6001, AUSTRALIA Has anyone ever found someone who used a Mac and then Changed To a PC?