Nafees Hassan wrote
By user, I mean another Delphi programmer. […] And I'm only targeting Delphi, I don't need to support other languages.
Then, this is not a problem at all.
The solution is: develop and use runtime packages instead of DLLs:
You can consider this type of units as a specialized form of PE (DLL), "a DLL for Delphi". They allow to distribute code between those units freely, as it was in one executable file. In other words, all constructs, including classes can be "imported" or "exported". You use ordinary Delphi Pascal syntax. The boundaries between runtime packages are quite transparent.
Not that runtime packages as a are roughly equivalent to .NET assemblies
, but not really equivalent in terms of their roles and development technology. In .NET, an assembly is usually the only compilation unit
; even though each can have more than one module
, multiple-module assemblies are not popular at all, and Visual Studio does not support them directly. In Delphi, there are two levels of library units:
is a separate compilation unit, a main encapsulation device, and several units can make a single executable module, which can be application, DLL, or the runtime package, so a package can be considered as a higher-level unit and can be re-used "at Delphi level".