This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/53398] feature request: option for overloaded methods order in vtable compatibility with msc
- From: "sweetrommie at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 21 May 2012 10:18:35 +0000
- Subject: [Bug c++/53398] feature request: option for overloaded methods order in vtable compatibility with msc
- Auto-submitted: auto-generated
- References: <bug-53398-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53398
--- Comment #2 from Roman Wieczorek <sweetrommie at gmail dot com> 2012-05-21 10:18:35 UTC ---
(In reply to comment #1)
> I think if we provide an option for this, we are
> going to have people abuse this.
The risk i see here is about compatibility of gcc compiled libraries with other
object files.
That's why i suggest changing vtable order only for a block of code, or for
single class, like "__attribute__ ((__packed__)))" does.
> Also I think the C++ ABIs between MS and GCC not compatible at all since they
> use different mangling.
Dynamic libraries (for windows) which follow COM spec, uses only pure virtual
class. They do not export class them in the dll, but provides an ansi C
function for creating an object.
In such cases the only exported objects are C functions.
It also avoids C++ name mangling problems.
As it goes for dll i met, it works. Probably because COM was well documented.
The only problem I found, is the order of overloaded functions. COM does not
allow overloading.
Here the method i showed helps and library becomes compatible.
> MS does not follow the cross target/compiler ABI (IA64
> C++ ABI).
The docs shows it is in section 2.5.3.1
http://sourcery.mentor.com/public/cxx-abi/abi.html#vtable
It is similar in COM spec (chapter 3)
http://www.daimi.au.dk/~datpete/COT/COM_SPEC/pdf/com_spec.pdf
No idea why msc behaves overloaded functions different.