Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Name mangling
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
====How different compilers mangle the same functions==== There isn't a standardized scheme by which even trivial C++ identifiers are mangled, and consequently different compilers (or even different versions of the same compiler, or the same compiler on different platforms) mangle public symbols in radically different (and thus totally incompatible) ways. Consider how different C++ compilers mangle the same functions: {| class="wikitable" !Compiler !{{codett|void h(int)}} !{{codett|void h(int, char)}} !{{codett|void h(void)}} |- |Intel C++ 8.0 for Linux | rowspan=5 | {{codett|_Z1hi}} | rowspan=5 | {{codett|_Z1hic}} | rowspan=5 | {{codett|_Z1hv}} |- |HP aC++ A.05.55 [[IA-64]] |- |IAR EWARM C++ |- |[[GNU Compiler Collection|GCC]] 3.''x'' and higher |- |[[Clang]] 1.''x'' and higher<ref>{{citation |url=http://clang.llvm.org/features.html#gcccompat |title=Clang - Features and Goals: GCC Compatibility |date=15 April 2013}}</ref> |- |[[GNU Compiler Collection|GCC]] 2.9.''x'' | rowspan=2 | {{codett|h__Fi}} | rowspan=2 | {{codett|h__Fic}} | rowspan=2 | {{codett|h__Fv}} |- |HP aC++ A.03.45 PA-RISC |- |[[Microsoft Visual C++]] v6-v10 ([[v:Visual C++ name mangling|mangling details]]) | rowspan=2 | {{codett|?h@@YAXH@Z}} | rowspan=2 | {{codett|?h@@YAXHD@Z}} | rowspan=2 | {{codett|?h@@YAXXZ}} |- |[[Digital Mars]] C++ |- |[[Borland]] C++ v3.1 |{{codett|@h$qi}} |{{codett|@h$qizc}} |{{codett|@h$qv}} |- |[[OpenVMS]] C++ v6.5 (ARM mode) |{{codett|H__XI}} |{{codett|H__XIC}} |{{codett|H__XV}} |- |OpenVMS C++ v6.5 (ANSI mode) | |{{codett|CXX$__7H__FIC26CDH77}} |{{codett|CXX$__7H__FV2CB06E8}} |- |OpenVMS C++ X7.1 IA-64 |{{codett|CXX$_Z1HI2DSQ26A}} |{{codett|CXX$_Z1HIC2NP3LI4}} |{{codett|CXX$_Z1HV0BCA19V}} |- |SunPro CC |{{codett|__1cBh6Fi_v_}} |{{codett|__1cBh6Fic_v_}} |{{codett|__1cBh6F_v_}} |- |Tru64 C++ v6.5 (ARM mode) |{{codett|h__Xi}} |{{codett|h__Xic}} |{{codett|h__Xv}} |- |Tru64 C++ v6.5 (ANSI mode) |{{codett|__7h__Fi}} |{{codett|__7h__Fic}} |{{codett|__7h__Fv}} |- |Watcom C++ 10.6 |{{codett|W?h$n(i)v}} |{{codett|W?h$n(ia)v}} |{{codett|W?h$n()v}} |} Notes: *The [[Compaq]] C++ compiler on [[OpenVMS]] [[VAX]] and [[DEC Alpha|Alpha]] (but not IA-64) and [[Tru64 UNIX]] has two name mangling schemes. The original, pre-standard scheme is known as the ARM model, and is based on the name mangling described in the C++ Annotated Reference Manual (ARM). With the advent of new features in standard C++, particularly [[template (programming)|templates]], the ARM scheme became more and more unsuitable β it could not encode certain function types, or produced identically mangled names for different functions. It was therefore replaced by the newer ''[[American National Standards Institute]]'' (ANSI) model, which supported all ANSI template features, but was not backward compatible. *On IA-64, a standard [[application binary interface]] (ABI) exists (see [[#External links|external links]]), which defines (among other things) a standard name-mangling scheme, and which is used by all the IA-64 compilers. GNU GCC 3.''x'' has further adopted the name mangling scheme defined in this standard for use on other, non-Intel platforms. *The [[Visual Studio]] and Windows SDK include the program {{code|undname}} which prints the C-style function prototype for a given mangled name. *On Microsoft Windows, the Intel compiler<ref>{{cite web|url=https://community.intel.com/t5/Intel-C-Compiler/OBJ-differences-between-Intel-Compiler-and-VC-Compiler/td-p/871131|title=OBJ differences between Intel Compiler and VC Compiler|website=software.intel.com|archive-url=https://web.archive.org/web/20220520203123/https://community.intel.com/t5/Intel-C-Compiler/OBJ-differences-between-Intel-Compiler-and-VC-Compiler/td-p/871131|archive-date=2022-05-20|url-status=dead}}</ref> and [[Clang]]<ref>{{cite web|url=http://clang.llvm.org/docs/MSVCCompatibility.html#abi-features|title=MSVC compatibility|access-date=13 May 2016}}</ref> uses the Visual C++ name mangling for compatibility.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)