[cxx-abi-dev] Function descriptors in vtable
Noam Lampert
noaml at mainsoft.com
Wed Jan 22 08:39:01 UTC 2003
Sorry,
It took me too long to figure out that my proposed solution here can't
work.
What could be done is
modify_vtable(funcdescriptor vt[], int nfuncs) {
for (i = 0; i < nfuncs; i++) {
void *p = malloc(sizeof(funcdescriptor));
*p = vt[i];
vt[i]->GP = p;
vt[i]->codeptr = &stub;
}
Sorry about the confusion.
Noam
P.S. I am still interested in a more elegant solution ;-)
> -----Original Message-----
> From: Noam Lampert [mailto:noaml at mainsoft.com]
> Sent: Wednesday, January 22, 2003 10:22 AM
> To: 'Cary Coutant'; 'Mark Mitchell'
> Cc: cxx-abi-dev at codesourcery.com
> Subject: RE: [cxx-abi-dev] Function descriptors in vtable
>
> Hi Mark, Cary,
>
> Your solution is in fact very elegant. I enjoyed reading it.
>
> If I understood it correctly, it solves very well the problem of
> defining an explicit vtable in C, and using it either from C or from
> C++.
>
> However, if the vtable was created by the C++ compiler, using it in C
is
> still very hard.
>
> If the memory in which the vtable resides is writeable, there might be
a
> solution that involves modifying the vtable in runtime:
> modify_vtable(funcdescriptor vt[], int nfuncs) {
> for (i = 0; i < nfuncs; i++) {
> vt[i]->GP = &vt[i];
> vt[i]->codeptr = &stub;
> }
> Is there a more elegant way to achieve this?
>
> Noam
>
More information about the cxx-abi-dev
mailing list