Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!orion.oac.uci.edu!beckman.com!dn71!a_rubin From: a_rubin@dsg4.dse.beckman.com Newsgroups: comp.os.msdos.programmer Subject: Re: malloc() and memory models Message-ID: Date: 13 Jun 91 21:25:25 GMT References: <4432@polari.UUCP> Distribution: comp.os.msdos.programmer Lines: 31 Nntp-Posting-Host: dn71.dse.beckman.com In <4432@polari.UUCP> empty@polari.UUCP (Terry Peterson) writes: >Under the following conditions, malloc() returns to main(), not to its caller, >foo().-- Using TC V2.0 > 1) The penultimate caller, main() is compiled as a small model program > 2) The caller of malloc(), foo(), is a library service compiled as a > large model. >Graphically, > main() /* Part of a small model program */ > | > ------->foo() /* A library service compiled as a large model */ > | > -------> malloc() This is unlikely to work (as you reported in the section I did not quote). If any routines are compiled large model, all routines must be compiled large model or the linkages will not be correct. In MSC, this would probably produce an error message as both libraries SLIB.. and LLIB.. would be searched. (I haven't tried it, but it's still wrong.) You can, of course, explicitly declare everything you use in main as near. -- 2165888@mcimail.com 70707.453@compuserve.com arthur@pnet01.cts.com (personal) a_rubin@dsg4.dse.beckman.com (work) My opinions are my own, and do not represent those of my employer.