Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to find what kind of framework I use in a delphi datamodule?

Tags:

delphi

I have the following problem in Delphi Berlin.
I have a datamodule that is keeping multiple platform functions with compiler directive.
For example
{$IFDEF ISVCLAPP} functions for VCL
{$IFDEF ISFMXAPP} functions for FMX
and so on
however i cannot get rid of FireDAC.VCLUI.Wait in the uses clause in an Android (FMX) enviroment.
I put FireDAC.FMXUI.Wait but it seems ignored by the compiler and keep adding regardles I do the VCLUI unit.

I belive that is something in the code that keeps telling the delphi enviroment that this is a VCL framework. Is there a way to find something like this?

like image 972
Popa Ovidiu-Razvan Avatar asked Mar 05 '23 18:03

Popa Ovidiu-Razvan


1 Answers

Unfortunately there is no built-in define one can check, but you can make your own. Create (or extend in a meaningful way) a file named UserTools.proj in %APPDATA%\Embarcadero\BDS\18.0 (for Delphi Berlin) with the following content:

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    <PropertyGroup>
       <DCC_Define>FrameWork_$(FrameworkType);$(DCC_Define)</DCC_Define>
    </PropertyGroup>
</Project>

This allows to check for the current framework in your source files like this:

{$IFDEF FrameWork_VCL}

or

{$IFDEF FrameWork_FMX}

Be aware that in some cases neither of these two may be defined at all.

Note that the file mentioned above is located in your user appdata folder, so other users need their own copy to make use of it.

like image 94
Uwe Raabe Avatar answered May 10 '23 16:05

Uwe Raabe