It is possible to do what you want, but I cannot imagine why you want. When we ported our application from D6 to D2010, we had a common source that will be built in both versions.
It was a purely transitional agreement. Once we were confident in the port of D2010, we tore the umbilical cord. And at that moment we were pleased to find the new features of the D2010.
To do this, we used the following crutches:
- Helper functions to mitigate ANSI / Unicode differences.
- Alias elements for working with renaming elements. For example, topic units changed names from D6 to D2010, and the unit alias function hid it.
- Oodles conditional code.
All this was necessary because we had the task of porting and therefore had to be compiled in both versions. The old version for our existing product service and the new version so that we can test and develop the port.
But I see no reason for you to do this. Not least because it leads to very complex code. If you want your application to be created in D7, then always create it in D7. Since you cannot use the functions of modern Delphi and maintain compatibility with D7, why use anything other than D7? When you buy modern Delphi, you also get access to older versions of Delphi.
source share