# abi Namespace Reference

The cross-vendor C++ Application Binary Interface. More...

## Functions
char * | cxa_demangle (const char *mangled_name, char *output_buffer, size_t *length, int *status)
| New ABI-mandated entry point in the C++ runtime library for demangling.

## Detailed Description

The cross-vendor C++ Application Binary Interface.

A brief overview of an ABI is given in the libstdc++-v3 FAQ, question 5.8 (you may have a copy of the FAQ locally, or you can view the online version at http://gcc.gnu.org/onlinedocs/libstdc++/faq/index.html#5_8).

GCC subscribes to a relatively-new cross-vendor ABI for C++, sometimes called the IA64 ABI because it happens to be the native ABI for that platform. It is summarized at http://www.codesourcery.com/cxx-abi/ along with the current specification.

For users of GCC 3.x, entry points are available in <cxxabi.h>, which notes, "It is not normally necessary for user programs to include this header, or use the entry points directly. However, this header is available should that be needed."

## Function Documentation

char* cxa_demangle | ( | const char * | mangled_name,
|  | char * | output_buffer,
|  | size_t * | length,
|  | int * | status
| ) |

  | New ABI-mandated entry point in the C++ runtime library for demangling. Parameters:
  | mangled_name | A NUL-terminated character string containing the name to be demangled.
  | output_buffer | A region of memory, allocated with malloc, of *length bytes, into which the demangled name is stored. If output_buffer is not long enough, it is expanded using realloc. output_buffer may instead be NULL; in that case, the demangled name is placed in a region of memory allocated with malloc.
  | length | If length is non-NULL, the length of the buffer containing the demangled name is placed in *length.
  | status | *status is set to one of the following values: 0: The demangling operation succeeded. -1: A memory allocation failiure occurred. -2: mangled_name is not a valid name under the C++ ABI mangling rules. -3: One of the arguments is invalid.
Returns: A pointer to the start of the NUL-terminated demangled name, or NULL if the demangling fails. The caller is responsible for deallocating this memory using `free`. The demagling is performed using the C++ ABI mangling rules, with GNU extensions. For example, this function is used in __gnu_cxx::__verbose_terminate_handler. See http://gcc.gnu.org/onlinedocs/libstdc++/18_support/howto.html#5 for other examples of use. Note: The same demangling functionality is available via libiberty (`<libiberty/demangle`.h> and `libiberty.a`) in GCC 3.1 and later, but that requires explicit installation (`--enable-install-libiberty`) and uses a different API, although the ABI is unchanged.