This is the mail archive of the
libc-alpha@sourceware.cygnus.com
mailing list for the glibc project.
Re: Linux vs. libio
Mark Mitchell wrote:
> With the new ABI, pointers to virtual tables come at a different point
> in the objects. Bases are laid out in different orders. There are no
> longer pointers to virtual bases. Some of that doesn't matter; some
> of it does. Given:
>
> struct _ios_fields { ... };
> class ios : public _ios_fields { ... };
>
> it is no longer the case that you can cast an `ios *' to an
> `_ios_fields *' without having to do modify the pointer value;
> More importantly, the same holds for streambuf and _IO_FILE. You
> can't cast an _IO_FILE to a streambuf, or vice versa, without
> modifying the pointer value.
<evil>
You might be able to do it by reserving a field in the new structures at
the right place to contain the old-Glibc-compatible vtable pointer, and
having two separate vtables. Only one vtable (and corresponding
structure layout) is active at a time. The other points to a set of
thunks. When you call a thunk, it modifies the vtable pointers to swap
which is the active vtable, reorders the data fields for the other ABI
and continues from there.
</evil>
;-)
-- Jamie