public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/53398] New: feature request: option for overloaded methods order in vtable compatibility with msc
@ 2012-05-18 14:28 sweetrommie at gmail dot com
  2012-05-20 19:59 ` [Bug c++/53398] " pinskia at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: sweetrommie at gmail dot com @ 2012-05-18 14:28 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53398

             Bug #: 53398
           Summary: feature request: option for overloaded methods order
                    in vtable compatibility with msc
    Classification: Unclassified
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: sweetrommie@gmail.com


The target of this topic is about mingw and ms compiler incompatibility.

GCC places overloaded virtual functions in order they appear in class
declaration.
In opposite msc reverts them.

Assuming we have a dll compiled in msc and such header for using the dll:

class A {
 virutal void overl(void) = 0;
 virutal void fun1(void) = 0;
 virutal void overl(int i) = 0;
 virutal void overl(double d) = 0;
 virutal void fun2(void) = 0;
 virutal void overl(char *c) = 0;
};

to use it with mingw compiler we need to change it to

class A {
 virutal void overl(char *c) = 0;
 virutal void fun1(void) = 0;
 virutal void overl(double d) = 0;
 virutal void overl(int i) = 0;
 virutal void fun2(void) = 0;
 virutal void overl(void) = 0;
};

or to portable version, which removes overloading (behave gcc ordering)

class A {
 virutal void overlC(char *c) = 0;
 virutal void fun1(void) = 0;
 virutal void overlD(double d) = 0;
 virutal void overlI(int i) = 0;
 virutal void fun2(void) = 0;
 virutal void overlV(void) = 0;
};

It would be nice to have some option to just say the compiler to use different
order.
We could have an option added to a compiler like -fvisibility-ms-compat or
-fabi-version=n.
Or maybe better by something like pragma pack push, so we can do:

#pragma vtorder(push, reverted)
#include "dll_header.h"
#pragma vtorder(pop)


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-05-28 15:50 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-18 14:28 [Bug c++/53398] New: feature request: option for overloaded methods order in vtable compatibility with msc sweetrommie at gmail dot com
2012-05-20 19:59 ` [Bug c++/53398] " pinskia at gcc dot gnu.org
2012-05-21 10:34 ` sweetrommie at gmail dot com
2012-05-23  8:34 ` sweetrommie at gmail dot com
2012-05-25 13:34 ` ktietz at gcc dot gnu.org
2012-05-28 15:52 ` sweetrommie at gmail dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).