[comp.lang.c] How much can a segment take??

stever@Octopus.COM (Steve Resnick ) (09/28/90)

In article <e8N5P1w163w@turbo.atl.ga.us> greg@turbo.atl.ga.us writes:
>I'm using TC++ (actually tcc.exe) and on compiling a program, I keep
>getting the error message : "Segment _TEXT exceeds 64K". I'm using the
>large memory model. Why is this a problem?? I thought the large memory
>model allowed my program to access over 64k??? Any ideas on what is
>causing this and how do I fix it??
>

In Turbo C, the compiler assigns _TEXT segments as <filename>_TEXT
when using large model. Are you sure you're using large model? If so,
then the next likely cause is that the compiled file generated a
code segment (<filename>_TEXT) larger than 64K. This can happen in 
large model when the code for a single source file is large. Try
breaking your source file into 2 or more smaller files and recompile. 
That should do it. 

Cheers!
Steve


-- 
----------------------------------------------------------------------------
steve.resnick@f105.n143.z1.FIDONET.ORG - or - apple!camphq!105!steve.resnick
Flames, grammar errors, spelling errrors >/dev/nul
----------------------------------------------------------------------------

prk@planet.bt.co.uk (Peter Knight) (09/28/90)

greg@turbo.atl.ga.us (Greg Montgomery) writes:

>I'm using TC++ (actually tcc.exe) and on compiling a program, I keep
>getting the error message : "Segment _TEXT exceeds 64K". I'm using the
>large memory model. Why is this a problem?? I thought the large memory
>model allowed my program to access over 64k??? Any ideas on what is
>causing this and how do I fix it??

The large model of most MS-DOS C compilers can only cope with each
object file (in Turbo's case this may not be written to disk, so strictly
isn't a file....) being less than 64K.  To make bigger programs, you need
to compile bits of the code seperately, and then link them together to form
your completed program, which may be greater than 64k.  Try reading the 
Microsoft C compiler documentation, if you can get hold of it. 

Peter Knight
BT Research

#include <std.disclaimer>