home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / sys / mac / programm / 13090 < prev    next >
Encoding:
Text File  |  1992-07-28  |  1.5 KB  |  47 lines

  1. Path: sparky!uunet!mcsun!uknet!axion!srd!pmcilroy
  2. From: pmcilroy@srd.bt.co.uk (Paul McIlroy)
  3. Newsgroups: comp.sys.mac.programmer
  4. Subject: Re: THINK C 5.0 Code overflow
  5. Message-ID: <1992Jul28.102350.8048@srd.bt.co.uk>
  6. Date: 28 Jul 92 10:23:50 GMT
  7. Sender: news@srd.bt.co.uk (News Administrator)
  8. Reply-To: pmcilroy@srd.bt.co.uk
  9. Organization: British Telecom
  10. Lines: 35
  11.  
  12. Christ Leijtens (christ@cs.few.eur.nl) writes 
  13. >  Is there *any* way to get around the 32K bound for
  14. >  the  code and data, so we can continue porting the 
  15. >  program to the Macintosh?
  16.  
  17. If no individual array or structure is bigger than 32K 
  18. compile all the declarations separately.  I know this sounds 
  19. daft, but it works.
  20.  
  21. e.g. if you have
  22.  
  23. 10_byte_struct_type a[3000];
  24. 12_byte_struct_type b[2000];
  25. 16_byte_struct_type c[1500];
  26.  
  27. then together these will cause a code overflow, but 
  28. individually they are OK.
  29.  
  30. So, split the three declarations into three .c files and 
  31. compile them separately (with the far data box checked in 
  32. the Set Project Type dialog). Then in the main program 
  33. declare a, b and c as external arrays.  I have done
  34. this myself and it works well.
  35.  
  36. If all else fails you can use malloc as others have 
  37. suggested, using static pointers instead of static arrays, 
  38. but be careful with linking.  If you have
  39.     extern 10_byte_struct_type a[3000];
  40. in one file it will not link to
  41.     10_byte_struct_type *a;
  42. in another.  You will need to change ALL your array 
  43. declarations to pointers, in all your files, which is really 
  44. tedious.
  45.  
  46. Paul McIlroy (pmcilroy@bt-sys.bt.co.uk)
  47.