forked from gcc-mirror/gcc
-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
__cdecl implies extern "C" for functions in C++ code #18
Comments
I need to review my |
dmik
changed the title
_cdecl implies extern "C" for functions in C++ code
__cdecl implies extern "C" for functions in C++ code
Dec 6, 2015
valerius2k
pushed a commit
to valerius2k/vbox
that referenced
this issue
Jun 5, 2022
This is temporary, see psmedley/gcc#18 for details. git-svn-id: http://svn.netlabs.org/repos/vbox/trunk@18 8b531da7-8337-e511-8bd3-62de69f6b5d0
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It seems that gcc 4.x.x for OS/2 causes functions to be declared using
extern "C"
semantics when they have__attribute__((__cdecl__))
attached to them. E.g. for this declaration in C++ contextthe resulting assembler name (signature) will be
_foo
instead of__Z3fooPPv
(which is the case if_cdecl
gets removed). This is not the case with gcc 3.x.x for OS/2 or with gcc 4.x.x on other platforms (e.g. OS X) and looks like a regression of my change that made functions declared as_System
in C++ context implyextern "C"
(for compatibility with IBM VAC).Frankly saying there are not many places where it breaks things, but one known case is VirtualBox. The RTCALL calling convention there is defined as
__cdecl
on OS/2 which causes all functions declared with RTCALL (and with RTDECL which implicitly uses it) to get C signatures instead of C++ ones. For some functions defined in C++ context this brings obvious problems, e.g. for overloaded operators that have the same name by definition (likeoperator+
) but different sets of arguments. This eventually results in several functions with the same signature and the following compiler error:The text was updated successfully, but these errors were encountered: