home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / os / mswindo / programm / misc / 4761 < prev    next >
Encoding:
Text File  |  1993-01-08  |  2.1 KB  |  53 lines

  1. Newsgroups: comp.os.ms-windows.programmer.misc
  2. From: chris@chrism.demon.co.uk (Chris Marriott)
  3. Path: sparky!uunet!pipex!demon!chrism.demon.co.uk!chris
  4. Subject: Re: Automatic data segment exceeds 64K 
  5. Distribution: world
  6. References: <C0IGp6.777@world.std.com>
  7. Organization: None
  8. Reply-To: chris@chrism.demon.co.uk
  9. X-Mailer: Simple NEWS 1.90 (ka9q DIS 1.19)
  10. Lines: 38
  11. Date: Fri, 8 Jan 1993 19:13:39 +0000
  12. Message-ID: <726520419snz@chrism.demon.co.uk>
  13. Sender: usenet@demon.co.uk
  14.  
  15. In article <C0IGp6.777@world.std.com> pbreen@world.std.com writes:
  16.  
  17. >"Jeffrey P. Overcash" <p00090@mail.psi.net> writes:
  18. >
  19. > [ stuff deleted]
  20. >If these don't help, the space is probably being taken up by a few static
  21. >arrays or structures.  If it is possible to change these to be allocated
  22. >from the heap, the problem may go away.  If it is not possible to allocate
  23. >them from the heap, you can force them to be put into a far segment by
  24. >including the _far keyword in the declaration - for instance 
  25. >
  26. >static long _far LargeArray[1000] = { 1, 2, ... 1000, };
  27. >
  28. >The one thing to watch for with this is that by default, Borland will
  29. >create a new far segment for each declaration of this type.  There is a
  30. >compile switch (and a #pragma) that force them all into the same far
  31. >segment but I forget what the switch is.
  32. >
  33. >Hope this helps,
  34. >
  35. >Patrick Breen
  36. >
  37.  
  38. The problem with doing this, though, is that the presence of FAR data makes
  39. the application single instance only.  There's no way around this.
  40.  
  41. If you have global arrays, it's better to replace it with a global pointer,
  42. and "GlobalAlloc" the actual memory.  If you need to store lots of static
  43. data for initialization, store it in the resource file and read it in at
  44. run-time.
  45. -- 
  46. --------------------------------------------------------------------------
  47. | Chris Marriott                           | chris@chrism.demon.co.uk    |
  48. | Warrington, UK                           | BIX: cmarriott              |
  49. | (Still awaiting inspiration              | CIX: cmarriott              |
  50. |  for a witty .sig .... )                 | CompuServe: 100113,1140     |
  51. --------------------------------------------------------------------------
  52.  
  53.