We use the "COM-like" model, which I work with, since we usually follow the rules of COM, but do not compile MIDL and do not target languages other than c / C ++. Thus, I know that I can always bend the rules according to my needs, but I try not to do this, because we may someday want to become COM-compatible, and if this day comes, we want it to be so painless , as much as possible.
I want to print a warning when someone compiles code using a specific method from a specific interface. In C ++ (we only support the Microsoft compiler), we add __declspec(deprecated)functions before the declaration to achieve our goal.
Can I add this before declaring an interface method or is there a better, more COM way to do this?
I would also like to know if just adding __declspec(deprecated)in front of this method is enough to force users to recompile (I would like to avoid this if possible).
thank
Update
I tried using __declspec(deprecated)before declaring my method as follows:
struct Interface : public IUnknown
{
__declspec(deprecated) virtual HRESULT __stdcall OldMethod
(
int Arg1;
int Arg2;
) = 0;
virtual HRESULT __stdcall NewMethod
(
) = 0;
}
OldMethod. , __declspec(deprecated) ?