Pyd: Wrapping too many functions in a class gives a compiler error

Pragma ericanderton at yahoo.removeme.com
Thu Jul 12 13:29:55 PDT 2007


Thomas Kuehne wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA512
> 
> Walter Bright schrieb am 2007-07-06:
>> Kirk McDonald wrote:
>>> That said, I will be looking into whether I can shorten those symbol 
>>> names. I'm going to be banging my head against this for the next few 
>>> days, I can tell.
>> This should only be a problem under Windows, which uses OMF which has a 
>> length limit. ELF under Linux has no limit.
> 
> Isn't there any way to sidestep the issue - e.g. something like the 
> long file names on DOS partitions?
> 

While I don't claim to speak for Walter, I have hacked around with OMF enough to answer this one.  In general, the 
problem cannot be fixed given OMF's design and limitations.  You'd have to extend OMF in some fashion, along with the 
linker, or abandon OMF in favor of a better object file format.

The problem is that the overly long template symbols are needed to allow the linker to do it's job: expunge redundant 
symbol definitions while locating the correct match for a dependency.  As the properties of a template instance is 
defined by its arguments, you really can't separate the two.  Combined, you get both run-time and link-time behaviors 
that depend heavily on the naming spec staying right where it is.  Change the spec, and you allow for false matches that 
can really screw things up.

My $0.02 on a possible solution:

Compression *might* be of some help here, like some kind of huffman coding that really crunches the symbol name down (D 
could probably get away with something resembling "UTF-4").  But it will only increase the maximum symbol length by a 
theoretical amount, so you'd still have problems, just with deeper nestings of templates than before.  Plus, any tweaks 
made to the compression behavior (including bugfixes) will result in a change to the naming spec (bad).

CTFE and mixins seem to be a decent workaround, but I know they're not always feasible.  I've had some success in the 
past blending them with templates, in order to keep symbol sizes within limits.

Push comes to shove, you can always go full-on ELF and use the GNU tool chain on Windows and not change a single line of 
code (barring win32 stuff of course).

-- 
- EricAnderton at yahoo



More information about the Digitalmars-d mailing list