Search code examples
csymbolsdebug-symbols

Use @$? symbols in a C function/variable


I'm curious if there's any way to use @, $, or ? in a C function or variable name. I know that linkers allow them (because of C++ name mangling).

Is there any kind of escape code that could allow this (I don't care how ugly it looks)? Or, in standard C, is this completely impossible?


Solution

  • It is not possible in purely standard C.

    But if using GCC (or probably Clang/LLVM) you can have $ in identifiers, and you can set the linker name using asm labels

    You could perhaps also play GNU ld tricks with ld scripts.