The Wiert Corner – irregular stream of stuff

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

  • 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,860 other subscribers

Archive for the ‘Delphi XE5’ Category

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, Resource Files and Scripts (.res/.rc), Software Development | Leave a Comment »

Delphi class constructors and initialisation order

Posted by jpluimers on 2016/12/27

A long while ago, but still an interesting discussion: Is there a predictable order of execution for Class Constructors? leading to these links:

–jeroen

Posted in Conference Topics, Conferences, Delphi, Delphi 10 Seattle, Delphi 2010, Delphi x64, Delphi XE, Delphi XE2, Delphi XE3, Delphi XE4, Delphi XE5, Delphi XE6, Delphi XE7, Delphi XE8, Development, Event, Software Development | Leave a Comment »

Delphi functional programming: Sequences

Posted by jpluimers on 2016/12/22

In functional programming, sequences are an important way of expressing logic.

This G+ post by Colin Johnsun discusses a library and a Spring4D way to handle sequences: I’ve release a library that allows you to iterate through a collection of items without using loops…

It’s interesting when mapping, reducing and solving many other problems in a functional way.

Background:

–jeroen

Posted in Delphi, 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 »

shadow_cs / delphi-leakcheck — Bitbucket

Posted by jpluimers on 2016/12/20

On my research list, as it works on both Windows and Android:

shadow_cs / delphi-leakcheck — Bitbucket: Multi-platform leak checking library for Delphi

via:

I’ve created a multi-platform leak checking library with DUnit integration and per test memory leak details… – Honza Rameš – Google+

–jeroen

Posted in Delphi, Delphi 10 Seattle, Delphi XE, Delphi XE2, Delphi XE3, Delphi XE4, Delphi XE5, Delphi XE6, Delphi XE7, Delphi XE8, Development, DUnit, Software Development | Leave a Comment »

Spring4D, Extended floating point values and Mac OS X: the 16-byte stack alignment

Posted by jpluimers on 2016/12/13

Just a few quick notes after solving a stack corruption issue in Spring4D on Mac OS X involving the Extended data type and 16-bit Stack Alignment:

–jeroen

Posted in Algorithms, Delphi, Delphi XE4, Delphi XE5, Development, Floating point handling, Software Development, Spring4D | Leave a Comment »

Indy: getting response despite exceptions or 4xx HTTP status codes

Posted by jpluimers on 2016/12/07

Formy snippet archive (thanks Walter Prins for answering and Oliver Funcke for asking and elaborating on the answer):

in the case of error, you can get what would’ve normally been in the contentstream from the ExceptionObj.ErrorMessage property.  So you can use something like the following if you want to get the content response regardless of http response code (untested):

var 
  FResponseStream: TStringStream;
  FRequestURL, Content : String;
begin
  //.... etc etc
  try
    FIdHTTP.Get(FRequestURL, FResponseStream);
    Content := FResponseStream.DataString;
  except
    on E:EIdHTTPProtocolException do
      Content := E.ErrorMessage; 
  end;
  // At this point, "Content" contains the response body, both for 
  // successful (200) as well as other response codes.
  
  //.... etc etc
end;

….

You can even do it simpler:

Response := IdHTTP.Get('http://host/path', [404]);

Source: delphi – Indy and REST – Can I prevent exceptions? – Stack Overflow

–jeroen

via:

Posted in Delphi, Delphi 10 Seattle, 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 | 2 Comments »

String resources and the $TypedAddress Compiler Directive require a PResStringRec typecast

Posted by jpluimers on 2016/12/01

Thanks Alexey for answering and Horácio for asking:

Use type-cast PResStringRec(@SArgumentNil_NilValue_Collection)

–jeroen

via: Hey guys, When I switch on $TypedAddress Compiler Directive, it is no longer…

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, Uncategorized | Leave a Comment »

The curse of the Project.res file.

Posted by jpluimers on 2016/11/29

A long time ago, Lars Fosdal wrote this on the Delphi G+ group:

It really is beyond me why there is no Project.rc file which includes

  • Project.version.rc
  • Project.icon.rc
  • Project.themes.rc
  • Project.manifest.xml
  • and so forth.

That way, the .res file would be a compile-time thing (or even a thing of the past) – and the resource linker would assemble the various bits from their individual sources.

It has been an issue forever. Vincent Parrett correctly commented that if you clean out too much out of the Project.res file, the IDE gets confused:

The only thing it is used for is version info and the mainicon (the IDE gets confused if don’t do that).

In my own experience, this isn’t the case for all Delphi versions, but I forgot which versions suffer and which don’t. I think the IDE theming issue omitting the Application word in the .dpr is related.

Like many of the G+ commenters, I’ve switched to script based resources for my own projects a long time ago. That’s also the reason why I forgot: this approach just works for any Delphi version.

This post is a reminder to self to see if the IDE has finally refrained from doing Project.res handling itself.

–jeroen

Source: The curse of the Project.res file…

Some related posts:

Posted in Delphi, Delphi 1, Delphi 10 Seattle, Delphi 2, Delphi 2005, Delphi 2006, Delphi 2007, Delphi 2009, Delphi 2010, Delphi 3, Delphi 4, Delphi 5, Delphi 6, Delphi 7, Delphi XE, Delphi XE2, Delphi XE3, Delphi XE4, Delphi XE5, Delphi XE6, Delphi XE7, Delphi XE8, Development, Software Development | 5 Comments »