On Mon, Mar 26, 2012 at 02:22:09PM -0700, Ian Lance Taylor wrote: > Mike Hommey <mh@xxxxxxxxxxxx> writes: > > > On Mon, Mar 26, 2012 at 01:48:45PM -0700, Ian Lance Taylor wrote: > >> Mike Hommey <mh@xxxxxxxxxxxx> writes: > >> > >> > Essentially, I would like to do something like: > >> > > >> > void *bar = (void *)_ZTV3foo; > >> > > >> > Except I only know "foo", and it may be namespaced. So is there some way > >> > to have g++ do the mangling with a macro or something else? > >> > >> There is no macro that does mangling, no. > >> > >> Why not simply > >> > >> void *bar = &foo; > > > > I want a pointer to the vtable. > > Oh, right, missed that. If you have an instance of the type, you could > use pointer manipulation and the C++ ABI > (http://codesourcery.com/cxx-abi/). But there isn't any direct way to > get that pointer, or the name of the vtable. Except I want to avoid having an instance of the type in the first place, because gcc is being unuseful creating static initializers to just copy the vtable pointer, while clang or msvc just do relocations. Mike