Mangled name of c++ symbol as string

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I have to access C++ symbols in multiple places through their linker names and 
wondered if there is something more maintainable than having 
to "brain-mangle" the names? What I would need is a builtin that transforms a 
name into its mangled representation as string at compile-time.

Essentially I would like to replace something like

__asm__(".set _ZN5media11colorspaces11YUV_CCIR601E, 
_ZN5media11colorspaces3YUVE\n"));

with

__asm__(".set " __mangle__(media::colorspaces::YUV_CCIR601E)  "," 
__mangle__(media::colorspace::YUV) "\n");

(to create a symbol alias) or

dlsym(hdl, "_ZN5media11colorspaces3YUVE");

with

dlsym(hdl, __mangle__(media::colorspaces::YUV));

As far as I could find the only assistance provided with name-mangling is 
run-time and only deals with the inverse problem. Does something like this 
exist (or is there a good reason why it *doesn't* exist and I should not be 
doing what I do?)
-- 
Mathematicians stand on each other's shoulders while computer scientists stand 
on each other's toes.
-- Richard Hamming

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux