I'm developing a library in DLL. To maintain ABI I have taken an approach to use interface which is exported to my client and implement that interface in my library. For my library to work I need large number of input parameters from user, for that I have declared a data class and taking the reference as input parameter in one of the interface function.
For example:
class CInputParam
{
public:
int a;
//......
int b;
};
class ISample
{
public:
virtual void SetInputParam(CInputParam& )=0;
virtual void DoWork()=0;
};
class CConcrete : public ISample
{
};
I have two question. 1) If in future I need to add any new input param say 'int c' then I will add into CInputParam, but this will break the ABI as I need to recompile all my clients. What could be the best solution?
2) In case if I need to add to a new virtual function, can I derive a new interface ISample2 from ISample, add the new virtual function and change the concrete class to derive from ISample2 (earlier derived from ISample).
class ISample2 : public ISample
{
public:
virtual void NewFunction()=0;
};
class CConcrete : public ISample2
{
};