Board index » delphi » Help: 'Error 49 - Data Segment too large'

Help: 'Error 49 - Data Segment too large'

Hi,
  I've been putting a program together from many sources, and when I
try to compile I get this error.  The help tells me to use pointers to
fix this, but isn't very specific.  I'm new to TP7, and I don't really
want to mess with pointers.  Can anyone help me fix this prob?
Thanks :)
Al. (al...@globalnet.co.uk)

 

Re:Help: 'Error 49 - Data Segment too large'


In article <34e98201.4034...@read.news.global.net.uk>

Quote
al...@globalnet.co.uk (Al Paterson) wrote:
> Hi,
>   I've been putting a program together from many sources, and when I
> try to compile I get this error.  The help tells me to use pointers to
> fix this, but isn't very specific.  I'm new to TP7, and I don't really
> want to mess with pointers.  Can anyone help me fix this prob?

In your case, it seems that there is no way round using pointers
(dynamic data structures). Look for all the big data structures in the
sources (e.g., records with several fields), and change their static
variables to pointers.

Best regards, The Chief
--------
Dr. A{*word*73}la A. Olowofoyeku (The African Chief)
Email: la...@keele.ac.uk
Homepage: http://ourworld.compuserve.com/homepages/African_Chief/
Author of: Chief's Installer Pro 4.12 for Win16 and Win32:
ftp://ftp.simtel.net/pub/simtelnet/win3/install/chief412.zip            

Re:Help: 'Error 49 - Data Segment too large'


Quote
Al Paterson wrote:

> Hi,
>   I've been putting a program together from many sources, and when I
> try to compile I get this error.  The help tells me to use pointers to
> fix this, but isn't very specific.  I'm new to TP7, and I don't really
> want to mess with pointers.  Can anyone help me fix this prob?
> Thanks :)
> Al. (al...@globalnet.co.uk)

Pointers aren't that hard and eventually you'll need them.

Suppose you have a variable:

var
  My_Var:array[1.30000] of integer;

This comes close to giving you an error so you couldn't declare many
more variables.
Now declare a type:

type
  My_Var_type=array[1.30000] of integer;

As you see this is the structure you need for My_Var.
Now declare My_Var as a pointer to such a structure:

var
  My_Var=^My_Var_Type;

This will let you access the same array, but now with a pointer. But
first you have to reserve memory for the structure:

begin
  new(My_Var);

Now if you want to access data in the array do it like this:

  My_Var^[Array_Index];

As you see this is almost the same as with a normal array only now you
use a pointer, indicated by the ^.

This is the basics, when you need it you need it.

Good luck,

Remco de Korte
Soft Machine
http://www.xs4all.nl/~remcodek/

Other Threads