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?

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.

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.

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)...

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!

This article has been dead for over six months. Start a new discussion instead.