Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!hc!lanl!cmcl2!phri!marob!daveh From: daveh@marob.MASA.COM (Dave Hammond) Newsgroups: comp.lang.c Subject: Re: Malloc Trouble with Large Memory Model Message-ID: <623@marob.MASA.COM> Date: 24 Apr 89 22:17:20 GMT References: <208@sabin.UUCP> <8596@xanth.cs.odu.edu> Reply-To: daveh@marob.masa.com (Dave Hammond) Organization: ESCC New York City Lines: 24 In article <8596@xanth.cs.odu.edu> kremer@cs.odu.edu (Lloyd Kremer) writes: >In article <208@sabin.UUCP> bjm@sabin.UUCP (Brendan J. McMahon) writes: >>Compile Message: >>Warning: cast of int expression to far pointer >>Run time problems: >>Printf(sizeof(struct labelrec)) = Some huge number >Apparently, code compiled in large model is attempting to use the small model >version of malloc(). Malloc is returning a 2-byte entity which is being >cast unsuccessfully to a 4-byte entity. You must recompile using the large >model version of malloc() (and all other library functions for that matter). Using the compiler switch -M2l insures that the compiler uses the large model library for the standard C routines. Assuming all of the your modules have been compiled with -Ml2, there should be no model mismatches. If you're using an ANSI compiler, be sure the standard C library prototype header stddef.h is included (for correct malloc prototype), otherwise try declaring malloc() in the modules which reference it: char *malloc(); -- Dave Hammond daveh@marob.masa.com