Apr 262020
 

The IFDEF editor expert was added to GExperts in 2016 and improved again in the same year, to support symbols defined in include files.

Unfortunately sometimes an include file itself sometimes includes other files (e.g. jclNN.inc in the JEDI Code Library includes jedi.inc) which will usually add additional symbols which are then available for conditional compilation. But the IFDEF expert only listed symbols from the original include file.

This has irked me for a long time, so today I changed this: Every include file that is included via an include file (and recursively via these include files) is now listed in the IFDEF expert:

In this example dzlib.inc itself includes dzlibjedi.inc which is simply a copy of jedi.inc. (I don’t want to include jedi.inc directly in order to not have a stale file laying around which might break compilation of other libraries.) The expert lists this file as if it had been included in the unit source code in addition to dzlib.inc.

And, since I seem to have forgotten to blog about it: The expert also searches for available include files in the search path and allows you to add them:

Just select the file from the menu and select the symbol you want to use. The required include directive will automatically be added to the interface section of the current unit.

If you want to discuss this blog post, go to the corresponding post in the international Delphi Praxis forum.

 Posted by on 2020-04-26 at 13:20