home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!mcsun!uknet!axion!srd!pmcilroy
- From: pmcilroy@srd.bt.co.uk (Paul McIlroy)
- Newsgroups: comp.sys.mac.programmer
- Subject: Re: THINK C 5.0 Code overflow
- Message-ID: <1992Jul28.102350.8048@srd.bt.co.uk>
- Date: 28 Jul 92 10:23:50 GMT
- Sender: news@srd.bt.co.uk (News Administrator)
- Reply-To: pmcilroy@srd.bt.co.uk
- Organization: British Telecom
- Lines: 35
-
- Christ Leijtens (christ@cs.few.eur.nl) writes
- > Is there *any* way to get around the 32K bound for
- > the code and data, so we can continue porting the
- > program to the Macintosh?
-
- If no individual array or structure is bigger than 32K
- compile all the declarations separately. I know this sounds
- daft, but it works.
-
- e.g. if you have
-
- 10_byte_struct_type a[3000];
- 12_byte_struct_type b[2000];
- 16_byte_struct_type c[1500];
-
- then together these will cause a code overflow, but
- individually they are OK.
-
- So, split the three declarations into three .c files and
- compile them separately (with the far data box checked in
- the Set Project Type dialog). Then in the main program
- declare a, b and c as external arrays. I have done
- this myself and it works well.
-
- If all else fails you can use malloc as others have
- suggested, using static pointers instead of static arrays,
- but be careful with linking. If you have
- extern 10_byte_struct_type a[3000];
- in one file it will not link to
- 10_byte_struct_type *a;
- in another. You will need to change ALL your array
- declarations to pointers, in all your files, which is really
- tedious.
-
- Paul McIlroy (pmcilroy@bt-sys.bt.co.uk)
-