name-mangling Questions

18

Solved

What exactly does putting extern "C" into C++ code do? For example: extern "C" { void foo(); }
Legation asked 25/6, 2009 at 2:10

4

Solved

void outputString(const char *str) { cout << "outputString(const char *str) : " << str << endl; } turns out to be Dump of assembler code for function _Z12outputStringPKc: 0x...
Auxiliaries asked 24/12, 2009 at 7:32

2

Solved

I am using Clang to parse some C++ code. I would like to print the name and mangled name for every FunctionDecl that I encounter. I can print the function name fairly easily by adding this to my ...
Sharika asked 22/11, 2016 at 11:24

16

Solved

I'm currently working on some logging code that supposed to - among other things - print information about the calling function. This should be relatively easy, standard C++ has a type_info class. ...
Paintbrush asked 11/11, 2008 at 18:52

1

The C++ ABI / mangling scheme that gcc/Linux uses is called the Itanium C++ ABI. Mangling is section 5.1. Apart from that one, how many other commonly used C++ ABIs and mangling schemes are there? ...
Lussi asked 21/11, 2021 at 2:6

4

Solved

is there any C++ name-mangling decoder for g++?
Drudge asked 17/12, 2010 at 8:26

4

I have a function class method, ValueHolder::printValue class ValueHolder { public: void printValue (); } ; How do I determine its mangled name at compile time (or runtime). For instance I wo...
Flossi asked 25/11, 2016 at 14:4

3

Solved

Consider the following function: template <typename A, typename B> auto Min(A&& a, B&& b) -> decltype(a < b ? std::forward<A>(a) : std::forward<B>(b)) { r...
Anything asked 8/11, 2012 at 18:1

0

By using c++filt -t command, I could demangle the name into proper type name (for instance, St3foo -> std::foo) Is there a way to reverse this thing so I could get St3foo by typing std::foo? The...
Pericardium asked 24/6, 2021 at 4:25

2

While I was trying to resolve a problem in static linking, I encounter a couple of _GLOBAL__sub_I_ prefixes in front of symbol names. It appears in that form although I used nm --demangle(-C). I s...
Ouzel asked 29/7, 2015 at 4:33

1

Solved

Suppose I have something along the lines of struct Foo { void goo() {printf("Test");} } external void _ZN3Foo3gooEv(Foo *f); int main() { Foo f; _ZN3Foo3gooEv(&f); } Is it possi...
Overpass asked 18/9, 2020 at 1:27

4

Solved

I am trying to port a 32-bit dll (and application) to 64-bit and I have managed to build it without errors. When trying to load it with my 64-bit application I noticed that the exported function na...
Sollows asked 21/1, 2015 at 8:16

1

Solved

I'm writing a project that gives advice about variable names, and I want it to tell if a name matches any of the reserved classes of identifiers. The first one ("private") is pretty strai...
Tuppeny asked 12/7, 2020 at 18:56

1

Solved

Consider the following example: struct A { using type = int; }; template <typename T> using B = A; template <typename T> typename B<T>::type f() { return {}; } template B<i...
Holcman asked 7/7, 2020 at 3:7

3

Solved

I have previously, here, been shown that C++ functions aren't easily represented in assembly. Now I am interested in reading them one way or another because Callgrind, part of Valgrind, show them d...
Calico asked 8/2, 2011 at 23:16

11

Solved

Why do we need to use: extern "C" { #include <foo.h> } Specifically: When should we use it? What is happening at the compiler/linker level that requires us to use it? How in terms of c...
Arrowwood asked 15/9, 2008 at 23:19

6

Solved

I am trying to learn and understand name mangling in C++. Here are some questions: (1) From devx When a global function is overloaded, the generated mangled name for each overloaded version is ...
Monoplane asked 30/5, 2010 at 2:2

11

Solved

How do I list the symbols being exported from a .so file? If possible, I'd also like to know their source (e.g. if they are pulled in from a static library). I'm using gcc 4.0.2, if that makes a d...
Walcott asked 29/8, 2008 at 16:57

2

When using c++ template, and especially tuples, I often get very long mangled names like _ZN11__sanitizer13InternalAllocEmPNS_28SizeClassAllocatorLocalCacheINS_20SizeClassAllocator32ILm0ELy1407...
Andrew asked 5/2, 2019 at 21:0

2

C++ compiler often mangle function names to support many features. Programer can suppress default name-mangling using extern "C" way. However, why int main(int, char **) not affected ever? // test...
Unseam asked 20/11, 2018 at 13:2

10

Solved

Please explain what is name mangling, how it works, what problem it solves, and in which contexts and languages is used. Name mangling strategies (e.g. what name is chosen by the compiler and why) ...
Prynne asked 22/8, 2009 at 0:20

4

Python provides private name mangling for class methods and attributes. Are there any concrete cases where this feature is required, or is it just a carry over from Java and C++? Please describe ...
Insociable asked 21/7, 2009 at 23:11

4

Solved

I have a .lib file, source code of which I don't have. I need an exported function from it, but I'm writing in C, and the function is C++ name-mangled. I can't write extern "C", because I don't ha...
Glaciate asked 11/9, 2012 at 13:55

1

Solved

1. the code class Parent { public: virtual void Foo() {} virtual void FooNotOverridden() {} }; class Derived : public Parent { public: void Foo() override {} }; int main() { Parent p1, p2;...
Gavrila asked 20/3, 2018 at 9:52

1

Based on my understanding, name mangling is used when there is function overloading, so that the functions with the same name can be distinguished. But I have noticed that name mangling is also us...
Naiad asked 6/7, 2017 at 13:28

© 2022 - 2024 — McMap. All rights reserved.