From: Jon Jenkins <jenkinsj@ozy.dec.com>
Subject: Re: DELPHI: Help! "Data Segment Too Large" How do I define a HUGE array
Date: 14 Jun 1995 22:26:33 GMT

Had the same problem and solved it thus:

type
   RESULTSPTR = ^RESULTS;
   RESULTS = ARRAY[1..301] of double;

{
   note **IF** the array is greater than 64k 
   then the size of the elements MUST divide
   equally into 64k. i.e. in my case double = 8 bytes
   and 301x8=2408 so no problem even if it is
   greater than 64k. The size of the elements
   for an array greater than 64k are just
   the powers of 2:
   2, 4, 8, 16, 32, 64, 128, 256 etc
   So you can do array of string[255] because 
   256 is exactly divisible into 64k.
   (256 = 255+1 extra byte 
   for size which is autmatically allocated)
   or if wanted bigger then use array
   of char but cant use string functions
}

var
   resptr: RESULTSPTR;

function whatever;
   begin
   New(resptr);
   end;

function NotWhatever;
   begin
   Dispose(resptr);
   end;

   
-- 
----------------------------------------------------------------------
Name:        Dr Jon Jenkins
Location:    Digital Equipment Corp, NaC, 
             Burnett Place, Research Park, 
             Bond University, Gold Coast
             QLD, AUSTRALIA 4229
Phone:       61-75-75-0151
Fax:         61-75-75-0100
Internet:    jenkinsj@ozy.dec.com
Close Proximity: "HEY YOU !!!"

The opinions expressed above are entirely personal and do not
reflect the corporate policy of DEC or the opinions of DEC management.
-----------------------------------------------------------------------

-------------------------------------------------------------------------------

From: stidolph@magnet.com (David Stidolph)
Subject: [delphi] Create a pointer to >64k memory
Date: Mon, 19 Jun 1995 11:27:32 -0400

I have needed to allocate and get pointers to memory greater than 64k.  To 
allocate the memory you can call GlobalAlloc/GlobalLock to get the memory 
from the system.

An easier way may be to use TMemoryStream.  With this class you can allocate 
any amount of memory and Read/Write from it easily.  The problem is getting 
a pointer to any point in the file.  Peter Below sent me some email on 
getting a pointer:

(please note that I have changed his code to make it a function and I need 
to do some more testing to verify all this)

function GetPtr(stream: TMemoryStream; offset: Longint): Pointer;
begin
  Result := Ptr(PtrRec(stream.Memory).seg+SelectorInc*HiWord(offset),LoWord(offset));
end;

As I get more info on this, I'll post it here.

By the way, has anyone gotten WinG and DIBs to work with Delphi?
