Requiring classes to be exported provide the following benefit :- LTO can finalize methods that aren't overridden. It include function that you want virtual by design, but you don't use that capability is your specific situation. In this regard, this is superior to the explicit virtual solution as it do not require to annotate virtual and can finalize method that would have to be annotated virtual.
- Shared object can be stripped of all non exported symbols, reducing their size.
- Reduce the surface area of breakage for shared objects.
It however require careful crafting of exported objects. I think this is mitigated by the fact that shared object interface require careful crafting anyway, as what is exported cannot be unexported (and cannot even change its ABI in way that aren't easily visible in the source).
The solution can be completed later by a tool as Andrei proposed (great idea), but by itself provide a lot of opportunity to finalize automagically. As you argued, this is the best way to go.
Executive summary :
- We can provide a toll to finalize the whole program.
- We can automatically finalize everything that isn't exported.
- We don't break any code.
- We get consistency between windows and UNIXes.
- Manu will rant.
I see only benefits :D