{{위키데이터 속성 추적}}
[[컴파일러]] 구조에서 '''네임 맹글링'''(name mangling)은 현대의 수많은 [[프로그래밍 언어]]에서 프로그래밍 엔티티의 고유한 이름을 사용할 때 발생하는 다양한 문제를 해결하기 위해 사용되는 기법이다.

[[컴파일러]]로부터 [[링커 (컴퓨팅)|링커]]로 더 시맨틱한 정보를 전달하기 위해 [[함수 (프로그래밍)|함수]], [[레코드 (컴퓨터 과학)|구조]], [[클래스 (컴퓨터 프로그래밍)|클래스]] 또는 다른 [[자료형]]의 이름에서 추가 정보를 인코딩하는 한 수단을 제공한다.

== 컴파일러별 동일 함수를 맹글링하는 방법 ==
{| 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'' 이상
 |-
 |[[Clang]]  1.''x'' 이상<ref>{{인용|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}}
 |}

== 같이 보기 ==
* [[응용 프로그램 이진 인터페이스]]
* [[호출 규약]]
* [[외부 함수 인터페이스]]
* [[자바 네이티브 인터페이스]]
* [[언어 바인딩]]
* [[SWIG]]

== 각주 ==
{{각주}}

== 외부 링크 ==
* [https://itanium-cxx-abi.github.io/cxx-abi/abi.html#mangling Linux Itanium ABI for C++], including name mangling scheme.
* [https://developer.apple.com/tools/mpw-tools/compilers/docs/abi_spec.pdf Macintosh C/C++ ABI Standard Specification]
* [https://sourceware.org/binutils/docs/binutils/c_002b_002bfilt.html c++filt] — filter to demangle encoded C++ symbols for GNU/Intel compilers
* [http://msdn2.microsoft.com/en-us/library/5x49w699.aspx undname] — msvc tool to demangle names.
* [http://demangler.com demangler.com] — An online tool for demangling GCC and MSVC C++ symbols
* [https://developer.apple.com/legacy/mac/library/documentation/Cocoa/Conceptual/OOPandObjC1/Articles/ocRuntimeSystem.html#//apple_ref/doc/uid/TP40005191-CH9-CJBBBCHG The Objective-C Runtime System] — From Apple's ''[https://developer.apple.com/legacy/mac/library/documentation/Cocoa/Conceptual/OOPandObjC1/Introduction/introObjectiveC.html The Objective-C Programming Language 1.0]''
* [http://www.agner.org/optimize/calling_conventions.pdf Calling conventions for different C++ compilers] by [[Agner Fog]] contains detailed description of name mangling schemes for various x86 and x64 C++ compilers (pp.&nbsp;24–42 in 2011-06-08 version)
* [http://www.kegel.com/mangle.html#operators C++ Name Mangling/Demangling] Quite detailed explanation of Visual C++ compiler name mangling scheme
* [http://sourceforge.net/projects/php-ms-demangle/ PHP UnDecorateSymbolName] a php script that demangles Microsoft Visual C's function names.
* [https://web.archive.org/web/20140410114817/http://www.parashift.com/c++-faq-lite/mixing-c-and-cpp.html Mixing C and C++ Code]
* {{서적 인용|author-last=Levine |author-first=John R. |author-link=John R. Levine |title=Linkers and Loaders |date=2000 |orig-year=October 1999 |edition=1 |publisher=[[Morgan Kaufmann]] |series=The Morgan Kaufmann Series in Software Engineering and Programming |location=San Francisco, USA |isbn=1-55860-496-0 |oclc=42413382 |chapter=Chapter 5: Symbol management |chapter-url=https://archive.today/20130126113557/http://www.iecc.com/linker/linker05.html<!-- http://www.iecc.com/linker/linker05.html --> |url=https://www.iecc.com/linker/ |access-date=2020-01-12 |url-status=live |archive-url=https://archive.today/20121205032107/http://www.iecc.com/linker/ |archive-date=2012-12-05}} Code: [https://archive.today/20200114225034/https://linker.iecc.com/code.html][ftp://ftp.iecc.com/pub/linker/]{{깨진 링크|url=ftp://ftp.iecc.com/pub/linker/ }} Errata: [https://linker.iecc.com/<!-- https://archive.today/20200114224817/https://linker.iecc.com/ 2020-01-14 -->]
* [http://www.int0x80.gr/papers/name_mangling.pdf Name mangling demystified by Fivos Kefallonitis]

{{응용 프로그램 이진 인터페이스}}

[[분류:라이브러리]]
[[분류:자바 (프로그래밍 언어)]]
[[분류:컴파일러 구성]]