Board index » delphi » To much global data defined in funcution!!!!

To much global data defined in funcution!!!!

Am using borland c++v5.01 and am compiling a dos program. Get following error
   "Too much global data defined in file in function xxx"

Origonally was having problem with error message "Dseg exceeds 64K" . This was solved by adding " Ff=64 " to compile line.
Is new error message connected with this?

Anybody got any suggestions as I cant reduce global variables declared
Thanks
Mike

 

Re:To much global data defined in funcution!!!!


Two things to try:

For any arrays that are declared globally or as static in which you do not
have a list of initialized values change the declaration to that of a
pointer and allocate it early in main, WinMain or OwlMain with malloc,
calloc or new.  Don't forget to free or delete [] them at the end of that
function.

Add the keyword __huge to a declaration.  For instance:

char __huge global_array_that_should_have_been_allocated_at_runtime[32000];

.  Ed

Quote
> Am using borland c++v5.01 and am compiling a dos
> program. Get following error
>    "Too much global data defined in file in function xxx"

> Origonally was having problem with error message
> "Dseg exceeds 64K" . This was solved by adding
> " Ff=64 " to compile line. Is new error message
> connected with this?

> Anybody got any suggestions as I cant reduce
> global variables declared

Re:To much global data defined in funcution!!!!


Quote
ms wrote:
> Am using borland c++v5.01 and am compiling a dos program. Get following error
>    "Too much global data defined in file in function xxx"

> Origonally was having problem with error message "Dseg exceeds 64K" . This was solved by adding " Ff=64 " to compile line.
> Is new error message connected with this?

> Anybody got any suggestions as I cant reduce global variables declared

Simple solution to the problem.  DON'T USE GLOBAL VARIABLES.  Sometimes this is unavoidable, especially if you are doing event
oriented programming but can be limited to a very small amount declared globally.

Other Threads