The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My work

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,311 other followers

Archive for the ‘Delphi 2006’ Category

Looking for more examples of Unicode/Ansi oddities in Delphi 2009+

Posted by jpluimers on 2017/09/25

At the end of April 2014, Roman Yankovsky started a nice discussion on Google+ trying to get upvotes for QualityCentral Report #:  124402: Compiler bug when comparing chars.

His report basically comes down to that when using Ansi character literals like #255, the compiler treats them as single-byte encoded characters in the current code page of your Windows context, translates them to Unicode, then processes them.

The QC report has been dismissed as “Test Case Error” (within 15 minutes of stating “need more info”) by one of the compiler engineers, directing to the UsingCharacterLiterals section of Delphi in a Unicode World Part III: Unicodifying Your Code where – heaven forbid – they suggest to replace #128 with the Euro-Sign literal.

I disagree, as the issue happens without any hint or warning whatsoever, and causes code that compiles fine in Delphi <= 2007 to fail in subtle ways on Delphi >= 2009.

The compiler should issue a hint or warning when you potentially can screw up. It doesn’t. Not here.

Quite a few knowledgeable Delphi people got involved in the discussion:

Read the rest of this entry »

Posted in Ansi, ASCII, CP437/OEM 437/PC-8, Delphi, Delphi 2006, Delphi 2007, Delphi 2009, Delphi 2010, Delphi 7, Delphi XE, Delphi XE2, Delphi XE3, Delphi XE4, Delphi XE5, Delphi XE6, Development, Encoding, ISO-8859, QC, Software Development, Unicode, UTF-8, Windows-1252 | Leave a Comment »

Delphi compiler: the –depends switch / DCC_OutputDependencies property outputs a .d file listing all .dcu and .dcp files – via Stack Overflow/G+

Posted by jpluimers on 2017/02/01

Every now and then you want to know what units your project is made of. Not just the units require to build your project, but actually the ones ending up in the executable (i.e. not removed by the compiler or linker).

I had long forgotten that Chris Hesik  [WayBack] wrote in debugging – How can I find all the units in my Delphi app? – Stack Overflow  [WayBack]:

you can have the Delphi compiler show you a list of used .dcus by passing –depends when you compile a project. It will output a .d file with a list of the .dcus (and .dcps) that were required.

This reminded me of that: The –depends option is supposed to work with the Delphi compiler, and it outputs a .d file. Does it still work in Berlin, and where is the file supposed to be output to? – David Nottage – Google+  [WayBack]

In the mean time, I wrote a batch file that parses the .MAP file to see which units actually made it into your .EXE  [WayBack] which works only for Widows executables (as I hardly do cross-platform Delphi development).

Uwe Schuster [WayBack] reported the IDE won’t pass on the –depends switch in Delphi XE and up (version 15.0.3953.35171) [WayBack] which means you need to pass this from the command-line.

Ondrej Kelle (G+/SO) pointed out that:

msbuild hello.dproj /property:DCC_OutputDependencies=true

  • It does work from the IDE if you check “use MSBuild externally”

The msbuild property setting is available in at least Delphi/C++Builder versions 2007 and 2010..Berlin as it is in CodeGear.Cpp.Targets and CodeGear.Delphi.Targets/RTL.Build.targets for BDS versions 5, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17 and 18. It might be available in versions 2005/2006/2009 as well but I don’t have these lying around any more.

–jeroen

Read the rest of this entry »

Posted in Delphi, Delphi 10 Seattle, Delphi 10.1 Berlin (BigBen), Delphi 2005, Delphi 2006, Delphi 2007, Delphi 2009, Delphi 2010, Delphi XE, Delphi XE2, Delphi XE3, Delphi XE4, Delphi XE5, Delphi XE6, Delphi XE7, Delphi XE8, Development, QC, Software Development | Leave a Comment »

Batch file to get a (non-sorted non-unique) list of units from a Delphi compiled map file

Posted by jpluimers on 2017/01/10

A few weeks ago in When you get “TfsScript.Execute” throwing a “Unregistered version of FastScript.” I wrote about “a process that explains any modules in the MAP file not resulting in DCU files”.

The below batch file aids in that process.

It takes a MAP file from your Delphi compiled executable that has debug information in text format which means you need to set your project linker options to generate detailed MAP files.

The Map Debug File (*.map) – RAD Studio documentation hasn’t much information but points to Detailed-Segments Map File – RAD Studio which has a bit more. Neither contain information on Delphi units as they focus too much on the C++ side of things. Then there is a tiny bit information in Understanding Delphi MAP File – Stack Overflow.

So I did some spelunking and came up with this batch-file which will likely work back until about the Delphi 7 era:

Read the rest of this entry »

Posted in Delphi, Delphi 10 Seattle, Delphi 2005, Delphi 2006, Delphi 2007, Delphi 2009, Delphi 2010, Delphi 7, Delphi XE, Delphi XE2, Delphi XE3, Delphi XE4, Delphi XE5, Delphi XE6, Delphi XE7, Delphi XE8, Development, Software Development | 1 Comment »

Delphi To Go: Include resource files in your Delphi build process

Posted by jpluimers on 2017/01/05

Something to remember: Delphi To Go: Include resource files in your Delphi build process

Note it’s not enough to add a line like this to your .dpr file:

{$R 'New1.res' 'New1.rc'}

The resources actually needs to be part of your .dproj file (which basically is an XML msbuild file adhering to the MSBuild Project File Schema Reference).

That way, the BrccCompile target in $(BDS)\bin\CodeGear.Delphi.Targets will automatically pick it up during build.

I just checked and these target files support BrccCompile:

  • ...\Embarcadero\RAD Studio\7.0\bin\CodeGear.Delphi.Targets 
  • ...\Embarcadero\RAD Studio\8.0\bin\CodeGear.Delphi.Targets 
  • ...\Embarcadero\RAD Studio\9.0\bin\CodeGear.Delphi.Targets 
  • ...\Embarcadero\RAD Studio\10.0\bin\CodeGear.Delphi.Targets
  • ...\Embarcadero\RAD Studio\11.0\bin\CodeGear.Delphi.Targets
  • ...\Embarcadero\RAD Studio\12.0\bin\CodeGear.Delphi.Targets
  • ...\Embarcadero\Appmethod\13.0\bin\CodeGear.Delphi.Targets
  • ...\Embarcadero\Studio\14.0\bin\CodeGear.Delphi.Targets 
  • ...\Embarcadero\Studio\15.0\bin\CodeGear.Delphi.Targets 
  • ...\Embarcadero\Studio\16.0\bin\CodeGear.Delphi.Targets 
  • ...\Embarcadero\Studio\17.0\bin\CodeGear.Delphi.Targets 
  • ...\Embarcadero\Studio\18.0\bin\CodeGear.Delphi.Targets

Which means it’s available as of Delphi 2007 until at least Delphi 10.1 Berlin and might even work in Delphi 2006

It could be a little bit flakey in Delphi 2007 (I’ve had many msbuild issues there) but more recent versions should be fine.

–jeroen

Related: I have a big file to add +’ at the beginning of a line and ‘ at the end…- shlomo abuisak – Google+

 

Posted in Delphi, Delphi 10 Seattle, Delphi 10.1 Berlin (BigBen), Delphi 2006, Delphi 2007, Delphi 2009, Delphi 2010, Delphi XE, Delphi XE2, Delphi XE3, Delphi XE4, Delphi XE5, Delphi XE6, Delphi XE7, Delphi XE8, Development, Software Development | Leave a Comment »

Delphi history – on the FINITEFLOAT compiler option that has no one-character shortcut

Posted by jpluimers on 2016/12/14

Back in the .NET days, Delphi had an FINITEFLOAT compile option that came without a single-character shortcut.

It was about the handling of infinite float and other special float values in cases like overflow and underflow (including +Inf, -Inf and  NaN).

At first – in the Delphi 8 (Octane) era of which few people want to be reminded off – it was the undocumented counterpart of the 8087 exception mask in x86 mode. Hallvard Vassbotn wrote an article about it and Chee Wee Chua documented it before it got documented in Delphi 2009 (that coincidentally dropped .NET support in the compiler – go figure):

Whereas the native Delphi compilers had exceptions turned on, Microsoft compilers (including .NET) had them turned off, hence the compiler option.

Like most new Delphi features in this century, FINITEFLOAT didn’t come without quirks. Often these are fleshed out in 2-3 product releases, but this one wasn’t:

The FINITEFLOAT compile option didn’t have a single-character shortcut. This made it impossible to use the {$IFOPT ...} construct as IFOPT only works for single-character compiler options.

Which means you get questions like Why doesn’t {$ifopt FINITEFLOAT ON} compile? – Stack Overflow (I actually got into writing this article because I found a {$DEFINE FINFINITEFLOAT_ENABLED} in some pretty old code) and compiler enhancement requests like [WayBack] QualityCentral – Please enhance the IFOPT directive for long switch names. It’s easier to read (which will likely never bee fixed).

For completeness some more information about exception masks in the native compiler:

  1. In the past you could only set the exception mask as part of the full control word using Set8087CW, nowadays you can use SetExceptionMask.
  2. Next to a precision mask, there are five exception masks you can set, see for instance this table from the Simply FPU Chap.1 Control Word section:

PM (bit 5) or Precision Mask
UM (bit 4) or Underflow Mask
OM (bit 3) or Overflow Mask
ZM (bit 2) or Zero divide Mask
DM (bit 1) or Denormalized operand Mask
IM (bit 0) or Invalid operation Mask

–jeroen

Posted in 8087, Algorithms, Delphi, Delphi 2005, Delphi 2006, Delphi 2007, Delphi 2009, Delphi 8, Development, Floating point handling, History, QC, Software Development | 1 Comment »

 
%d bloggers like this: