Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Check at compile time if a unit exists

I want to use a unit if it exists. Is there something like {$IF Declared(MyUnit)} for units, or a different way?

I installed a demo version of a component package, and would like to conditionally use units from it, and conditionally add menu items for testing its functionality. All without forcing everybody to install the demo package.

like image 765
Uli Gerhardt Avatar asked Oct 29 '25 17:10

Uli Gerhardt


1 Answers

This isn't possible. You would need there to be a condition statement that performed search for a unit. Looking in the units listed in the project file, and then the search paths. However, there is no such conditional.

The best you can do is to use these units only if a conditional symbol is defined. You would then need to define that symbol in your project.

This is obviously inconvenient but it's only necessary while you evaluate the component. Once the evaluation is complete you will adopt it universally, or not at all. In the meantime you will have to live with a degree of awkwardness.

like image 73
David Heffernan Avatar answered Oct 31 '25 17:10

David Heffernan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!