Checking at compile time if a device exists
I want to use a block if it exists. Is there something like {$IF Declared(MyUnit)}
for units or another way?
I have installed a demo version of a component pack and would like to conditionally use units from it and conditionally add menu items to test its functionality. All without forcing everyone to install the demo package.
source to share
It's impossible. You will need there the condition that performed the unit search. Browse in the units listed in the project file, followed by the search paths. However, this conditional does not exist.
The best you can do is to only use these devices if a symbol is defined. Then you will need to define this symbol in your project.
This is clearly inconvenient, but only needed when evaluating a component. Once the assessment is complete, you will accept it universally or not at all. In the meantime, you will have to live with a degree of awkwardness.
source to share