ELFTC_DEMANGLE(3)
β¨ NAME β¨
elftc_demangle β demangle a C++ name.
Okay bestie, welcome to the ELFTC_DEMANGLE(3) page from the Library Functions Manual π
β¨ This is the whole vibe: elftc_demangle takes a C++ encoded symbol name and gives you back something that looks like a C++ prototype. Iconic, honestly.
π«Ά LIBRARY π«Ά
library libelftc β yes, that's the one holding this function down π
π¦ SYNOPSIS π¦
#include <libelftc.h>
int
elftc_demangle(const char *encodedname, char *buffer, size_t bufsize,
unsigned int flags);
πΈ DESCRIPTION πΈ
Function elftc_demangle() decodes a symbol name encoded according to the type encoding rules for the C++ language and returns a string denoting an equivalent C++ prototype. No cap, that's the whole job π₯
Argument encodedname specifies the encoded symbol name. Argument buffer denotes a programmer-specified area to place the prototype string in. Argument bufsize specifies the size of the programmer-specified area. Argument flags specifies the encoding style in use for argument encodedname.
Supported encoding styles are:
ELFTC_DEM_ARMβ the encoding style used by compilers adhering to the conventions of the C++ Annotated Reference Manual.ELFTC_DEM_GNU2β the encoding style by GNU C++ version 2.ELFTC_DEM_GNU3β the encoding style by GNU C++ version 3 and later.
Argument flags may be zero, in which case the function will attempt to guess the encoding scheme from the contents of encodedname. Lowkey magic, but that's what it says πͺ
π RETURN VALUES π
Function elftc_demangle() returns 0 on success. In case of an error it returns -1 and sets the errno variable. So 0 is the slay result, -1 means check errno bestie π
π EXAMPLES π
To decode a name that uses an unknown encoding style use:
char buffer[1024];
const char *funcname;
funcname = ...; /* points to string to be demangled */
if (elftc_demangle(funcname, buffer, sizeof(buffer), 0) == 0)
printf("Demangled name: %\n", buffer);
else
perror("Cannot demangle %s", funcname);
π ERRORS π
Function elftc_demangle() may fail with the following errors:
[EINVAL]β Argumentencodednamewas not a valid encoded name.[ENAMETOOLONG]β The output buffer specified by argumentsbufferandbufsizewas too small to hold the decoded function prototype.
π SEE ALSO π
Go peek at elf(3) and elf_strptr(3) if you're feeling curious π¦β¨
mwah π β this page is from Debian, dated August 24, 2011, and it's the ELFTC_DEMANGLE(3) manual page signing off π
π¦ where this page comes from
- freebsd 14.5: base 14.5
- freebsd 15.1: base 15.1
- nixpkgs unstable: libelftc 15.0.0
- Copyright (c) 2009,2011 Joseph Koshy. All rights reserved
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms