[lug] (OT) C++ ?, pointers to member functions
D. Stimits
stimits at idcomm.com
Wed Aug 8 18:04:48 MDT 2001
Tom Tromey wrote:
>
> >>>>> ">" == D Stimits <stimits at idcomm.com> writes:
>
> >> I would expect that regardless of how vtables are layed out, if an
> >> object uses virtual functions like f(), then you should be able to
> >> refer to the function with a relative offset anyway.
>
> I don't understand what you mean.
>
> If you are talking about using C++ language features across, say,
> shared objects, then that will work fine (with every compiler I've
> heard of) if everything is compiled with the same compiler.
>
> For instance, if you have one library which implements a base class
> with a virtual function f, and then another library which has a
> class derived from `base' which overrides `f', then your program can
> call `obj->f' without fear; it won't matter where the actual class of
> `obj' is implemented.
This is what I mean. It makes access to member functions via pointer
possible, although with limitations.
>
> If you mean trying to somehow manipulate the vtable directly,
> independently of the compiler, then you're in for disappointment. The
> layout really does change significantly.
This is not what I mean, the former is it.
D. Stimits, stimits at idcomm.com
>
> Tom
> _______________________________________________
> Web Page: http://lug.boulder.co.us
> Mailing List: http://lists.lug.boulder.co.us/mailman/listinfo/lug
More information about the LUG
mailing list