I have a library that is using Generic methods in Delphi classes. Such as
function CreateInstance<T: TMyInstance>(const Name: string): T; overload;
There will be a lot of different instance types that derive from TMyInstance.
It seems that the compiler properly generates headers for C++Builder as follows:
template<typename T> T __fastcall CreateInstance(const System::UnicodeString Name)/* overload */;
but it does not seem to work in practice, except for a few types that I have created alias functions in the library too.
So, all in all, I decided to add another option for instantiating the different types that works also in C++. But I would still like to keep the Generic functions in Delphi.
Is there any way to disable the generation of these function templates, so that the C++ Builder users of the library would not even see them - since they will not work for them, anyways?
I tried {$NODEFINE}, but it seems to exclude complete types only and not individual functions.
I can imagine that I can remove the generated lines from the hpp-files after the build with a script, but it feels a bit kludgy.