BdLm
asked on
$define, different setting within different software projects
inside a unit i need different versions of a string constant.
where to put the {$DEFINE LET} command inside different project mainforms ?
In the project source code ? in the mainForm class definition I tried already and failed
where to put the {$DEFINE LET} command inside different project mainforms ?
In the project source code ? in the mainForm class definition I tried already and failed
unit ......;
{$IfDef LET}
RegistryStringPath = 'Software\Version0\Settings'
{$Else}
RegistryStringPath = 'Software\Version1\Settings'
{$EndIf}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
if you want to place it in your code, then you could do it in an .inc file, which you then include in your units where you need to do this test... this inc-file shall then be different for your two project versions... in one version LET will be defined,and in the other it will not.
When you include such a file you do it with compiler directive {$I}, and this should be considered as if the compiler replaced the {$I} directive with the contents of the included file, at that point in your source code.
ex:
implementation
...
{$I 'MyProjectDefines.inc'}
...
regards
Hypo
When you include such a file you do it with compiler directive {$I}, and this should be considered as if the compiler replaced the {$I} directive with the contents of the included file, at that point in your source code.
ex:
implementation
...
{$I 'MyProjectDefines.inc'}
...
regards
Hypo
ASKER
but this means I have to change the include file once I run the second project, Your first solution seem to be better for me
Thanks
Thanks
ASKER
would there also be a methode to place it somewhere in the code, may be more easy to remember ?