C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Allow conversion of memfunc pointers to func pointers

From: Frederick Virchanza Gotham <cauldwell.thomas_at_[hidden]>
Date: Fri, 19 Jan 2024 22:47:22 +0000
On Friday, January 19, 2024, Thiago Macieira wrote:

> >

> I'm tempted to do what Arthur did and fork the GNU linker, try to make a
> > list of all the vtables and all the type_info's, and then create the
> > aforementioned sorted map in order to implement 'void const
> > *std::get_polymorphic_facilitator(type_info const &)'.
>
> Go ahead. This will either tell you that the cost is too high or will show
> a
> solution I haven't thought of. But see above: I don't think you need this
> at
> all (X-Y-Z case).
>


I've posted to the mailing list for binutils. If you scroll to the bottom
of this page:

    https://sourceware.org/pipermail/binutils/2024-January/date.html

You'll see my thread entitled "Linker : Make a map of typeinfo to vtable".

Actually, just after having sent that post, I realise that it's not the
linker but rather the C++ compiler that generates the vtables and
typeinfo's and puts them inside the object files. So the linker will load
in all the object files and see a list of typeinfo's and vtables. So then,
inside the linker, I need to create my array which will map typeinfo hash
codes to vtables, and then I need to define the symbol
'__map_typeinfohash_vtable' and let the normal linker code take it from
there.

Even if this feature turns out to be useless, it will be good practise for
me to get into editing compilers/linkers. I reckon it will be useful though.

Received on 2024-01-19 22:47:24