I have used compilers and languages for a long time and it is the first time that I have encountered a compiler (Delphi 2006) that actually throws away public types from not only .Net executables but also packages.
Discarding from an executable is kind of understandable because Borland simply extends the same assumption they used in Delphi.W32 to Delphi.Net, admittedly very foolishly and ignorantly. Borland probably does not realise that one can load an executable assembly in much the same way as a DLL assembly.
To see this, you can get the IDE wizard to generate say a VCL.Net Form application. Anywhere in a pas file, create a type in the interface section and build it.
Then examine the final product with a Lutz Reflector and you will find that Delphi has discarded this type. I suspect that Borland only discards the IL metadata of this type, the one that the Reflector and System.Reflection depends on but keeping them in Delphi's metadata.
In other word, Delphi.Net is producing dll for Borland environment only.
To retain this type, you need to create a dummy variable of this type in the implementation section. Now you will see this type being retained.
What is insane of Borland is to discard public types from a package? Public type in a DLL is meant to be used by another DLL or executable and so how could Delphi know that no one is going to reference this type and is safe to discard them?
My discovery has proved that Borland has made very unsafe judgment bordering on insane.
This discarding public types bug is the root cause of Delphi not generating correct IL code.
A site devoted to discussing techniques that promote quality and ethical practices in software development.
- ► 2013 (13)
- ► 2012 (23)
- ► 2011 (23)
- ► 2010 (60)
- ► 2009 (60)
- ► 2008 (25)
- Road map from Windows to Linux
- Delphi.Net Bug - Discarding unreferenced types
- A Delphi.Net IL generation bug
- More and more reasons to stay away from Vista
- More on IE Vs Firefox market share
- Vista firewall - outbound traffic is unblocked by ...
- Evidence of IE market share slipping
- Jim Gray is missing.
- ▼ February (8)