This is taken directly from a newsgroup posting on softvelocity.public.clarion6. I hope Robert doesn’t mind me reproducing this here, I think it is a very helpful explanation that should be useful to folks running into SEGDEF problems with Clarion…
Re: Any increase on DCT & Window limits?
On 22/01/2004 12:20:26 AM, robert.zaunere wrote:
There are many theories floating about with regard to this "limit",
unfortunately none of them are accurate. There is a Zero correlation to any
16bit issue in C6 with this topic of SEGDEFs, as 16bit is not even supported
for compilations, and the segment limit has not changed from C5x.
As explanation as to what does happen, the linker must collect information
about object and resource files to be linked into the target. The limit for
number of segments per object file is ~16k.
The compiler produces segments for things like:
- Every Procedure or ROUTINE is a separate segment;
- Every static variable or constant string is a separate segment;
- Every FILE structure produces 5 segments, plus if the FILE declaration has
NAME, OWNER or driver string, one segment
per every for one of these strings, plus one possible segment if FILE is
threaded, every KEY, every Memo, every VIEW, every QUEUE, etc. etc.
So in general, the current linker limit means that a single source file can
have _thousands of declared (and used in the program) variables. The most
probable ways to get the "too many SEGDEF…" error are:
1- to include too many INCLUDEs that declare variables; solution is
to include files on the module level rather than globally everywhere
where it is possible
2- to declare too many FILEs with large number of KEYs and/or MEMOs in
one source file (the main source file, as a rule);
#1 is your control. As for #2 its also in your control, but we’ll be providing
template support in C6.1 that will allow you to easily split the file structs
generated from extremely large DCTs (those with with many hundreds of files
defined in them) into > 1 source modules. That means that when such DCTs
produce an excess of the ~16000 segment limit you can get past it. However,
there are other alternatives you can take right now, like reducing the # of
files declared in a single DCT to something more in line with what Files are
really being used in the APP, or to declare files on the member module level if
this is possible (i.e. the FILE is only used in particular procedure ). But
the template solution will be forthcoming.