Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!elroy.jpl.nasa.gov!decwrl!borland.com!alexande From: alexande@borland.com (Mark Alexander) Newsgroups: comp.os.msdos.programmer Subject: Re: Re: Memory Models in TC2.0 Message-ID: <1991Jun6.164518.20769@borland.com> Date: 6 Jun 91 16:45:18 GMT References: <16856@helios.TAMU.EDU> <4660001@pollux.svale.hp.com> Organization: Borland International Lines: 20 In article <4660001@pollux.svale.hp.com> kevino@pollux.svale.hp.com (Kevin Owen) writes: >I went through this same problem and found that the secret was to change >all calls to "malloc()" to "farmalloc()". It appears that compiling in >the compact and large models automagically sets all of your data types to >"far" but does not change the values that functions return. There are couple of mistakes here. 1. You should not have to use farmalloc() instead of malloc() -- farmalloc() is identical to malloc() in large data models. Nor should you have change all your pointer variables to far (as an earlier posting suggested). 2. Pointer variables, pointers returned by functions, and pointers passed to functions will automatically become far pointers in large data models, unless you explicitly make them near. Perhaps the problem was that the program did not include or otherwise include a prototype for malloc(). Or perhaps the wrong run-time library was being linked.