There are existing answers that cover general cases, but they are a bit vague, and I have to be sure of that.
Consider:
- An existing defined class derived from the abstract base class "interface".
- A class is part of a library that is compiled into several DLLs that communicate with each other through an interface.
Then add:
- The second "interface" from which a specific class will now be created (now it has two interfaces).
- New virtual methods for a specific class accessed by the new interface.
Do I need to recompile every DLL that links this library, or just DLLs that use the new methods?
EDIT:
My original interface provides the dynamic method Dynamic(int OP, void* args) , can I add op, which adds a new interface?
How does COM manage to add new interfaces to objects without distorting existing interfaces? Does it contain interfaces, uses multiple inheritance, etc.
Let me outline how this works.
Library Static Binding Interfaces
In statically linked library class Interface1 { virtual Method1() = 0; virtual Method2() = 0; } class NotReallyInterface2 : Interface1 { virtual Method1() = 0; virtual Method2() {
In dlls
In A.dll Load statically linked library class A : NotReallyInterface2 { virtual Method1() { // does something } } In B.dll Load statically linked library class B: NotReallyInterface2 { virtual Method1() { // does something different } }
I want to add
class Interface3 { virtual Method3() = 0; }
I have some problems here because my inheritance structure looks like.
[a.dll [ library : Interface1 < NotReallyInterface2 ] < A ] [b.dll [ library : Interface1 < NotReallyInterface2 ] < B ]
so i'm afraid
[ a.dll [ library : Interface1 < NotReallyInterface2 ] < Interface3 < A ]
will not work.
Edit 2
So, I found my problem. Apparently, other DLLs and executables are referencing my NotReallyInterface2 . This means that multiple dlls and exes build the same base class. Therefore, if these “copies” of the base class fail, the ship goes down. This means that I cannot change one method signature in NotReallyInterface2 .
This would work if no one referenced NotReallyInterface2 , and now I get it from the answers, and all this makes sense.