Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!unmvax!nmtsun!jrwsnsr From: jrwsnsr@nmtsun.nmt.edu (Jonathan R. Watts) Newsgroups: comp.lang.pascal Subject: Re: Turbo Pascal 5.5 and Overlays Keywords: turbo pascal 5.5 overlays units Message-ID: <3582@nmtsun.nmt.edu> Date: 1 Dec 89 03:37:11 GMT References: <6458@shlump.nac.dec.com> Organization: New Mexico Tech, Socorro NM Lines: 44 In article <6458@shlump.nac.dec.com>, granoff@decwin.enet.dec.com (Mark H. Granoff) writes: > [Oops, I accidentally deleted a line] > a little test program (included after this text, from memory). The > problem is that when I run the .EXE, I get a runtime error 208 (which > means that I haven't init'd the Overlay manager). This doesn't make > sense though because the error occurs at the BEGIN for the main > program, before the program would have had a *chance* to init the > overlay manager! What am I missing? Thanks. > > OVRUNIT.PAS > UNIT ovrunit; > {$O+,F+} > INTERFACE > procedure ovrjunk; > IMPLEMENTATION > procdure ovrjunk; > begin > writeln('procedure ovrjunk called.'); > end; > BEGIN ^^^^^ > END. The "BEGIN" is the problem. Since you have a begin, the compiler assumes you have an initialization section, and you can't have an overlaid unit with an initialization section BEFORE the Overlay manager has been initialized! For a complete description of the problem (and the solution), see "Initialization Sections in Overlaid Units" on p.167 in the Reference Guide. Sorry for not mailing the response, but this Sun is running VERY, very, slowly today, and I'm not going to go through the hassle of getting this mailed (I've been waiting minutes at a time for the system to respond while typing this message!). If someone wants to forward this to original poster, feel free. - Jonathan Watts jrwsnsr@jupiter.nmt.sun f o d d e r