Fragile virtual functions

Michel Fortin michel.fortin at michelf.com
Sat Mar 8 19:28:30 PST 2008


On 2008-03-08 17:48:14 -0500, "Craig Black" <craigblack2 at cox.net> said:

> I am the primary author of an API that is used by other programmers.  
> It uses plugin libraries.  Adding new virtual functions does change the 
> ABI and it's very annoying.  Developers that use this API will usually 
> complain if there is an ABI change, because it means that everyone's 
> plugins have to be recompiled for compatibility.  This somewhat 
> cripples development when ABI compatibility is required.
> 
> So I concur with your observation that this is a problem.  However, I 
> would consider your suggestion to be an incomplete solution.  Because, 
> as you say, it doesn't solve the problem for subclasses.  Does anyone 
> have an idea that would be a full solution?  Of course, we are not 
> talking about modifying or removing existing virtual functions.  Just 
> adding them.

I also consider it an incomplete solution, but it's still better than nothing.

I think solving the problem for subclasses would require the virtual 
table to be dynamically built while loading the library, and the 
virtual table offsets for the trampoline functions I suggested in my 
last post would have to be set accordingly at the same time.

-- 
Michel Fortin
michel.fortin at michelf.com
http://michelf.com/




More information about the Digitalmars-d mailing list