954,529 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Delphi 16 bit - Code segment too large

Please you clever guys.
I have an old Delphi and get "Code segment too large" when I try to run my program.
I don´t even know how I can use "Code segments".
After using built in help I tried to insert {$S 50000} in the source code, but with same result.

Please can someone explain how to get around this obsticle, or even better force right through it?

AKJo
Junior Poster in Training
59 posts since Jan 2008
Reputation Points: 10
Solved Threads: 0
 

16-bit x86 processors divide memory into "segments". Typically, all your code must fit in one segment. The way around this is to use " overlays ". Good luck.

Duoas
Postaholic
2,043 posts since Oct 2007
Reputation Points: 1,140
Solved Threads: 229
 
16-bit x86 processors divide memory into "segments". Typically, all your code must fit in one segment. The way around this is to use " overlays ". Good luck.

Thanks.
I searched for overlays, but only found TP and got the impression that Delphi should take care of that as soon as the segment size is within the limits. There is nothing mentioned about it in Help function for my Delphi.

Why can´t I change my Segment size from default 16 384 to something else? How?

Hope for some good ideas.

AKJo
Junior Poster in Training
59 posts since Jan 2008
Reputation Points: 10
Solved Threads: 0
 

Sorry, I must have been asleep when I thought you were using TP. Delphi 1 is a 16-bit compiler, so the same restrictions apply. But it doesn't provide overlays I don't think.

I don't remember how to fix it so let me look at it and see what I can come up with (unless someone else here knows)...

Duoas
Postaholic
2,043 posts since Oct 2007
Reputation Points: 1,140
Solved Threads: 229
 

After some googling, the best answer is that you are getting the message when trying to compile your program, and it is because you have one or more modules that are too large.

For example, if you have all your code in a single .dpr then you need to add some units and move code out of the .dpr.

The same goes for units. Each unit must compile all its code and data to fit in a 32K segment. Figure out which unit is giving the 'too large' error and split it into two smaller units.

You can also save some space by disabling things like range checking and overflow checking. (Don't disable stack checking though.)

Good luck!

Duoas
Postaholic
2,043 posts since Oct 2007
Reputation Points: 1,140
Solved Threads: 229
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You