[cxx-abi-dev] Function descriptors in vtable

Noam Lampert noaml at mainsoft.com
Wed Jan 22 08:22:28 UTC 2003


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