Related articles |
---|
How to build your own stack frames? (interpreter questions) seguin@engin.umich.edu (1995-08-20) |
Re: How to build your own stack frames? (interpreter questions) tonyk@cybercom.net (1995-08-21) |
Re: How to build your own stack frames? (interpreter questions) Lassi.Tuura@hut.fi (1995-08-21) |
Re: How to build your own stack frames? (interpreter questions) rick@metronet.com (1995-08-22) |
Re: How to build your own stack frames? (interpreter questions) tonyk@cybercom.net (1995-08-22) |
Newsgroups: | comp.compilers |
From: | tonyk@cybercom.net (Antoun Kanawati) |
Keywords: | interpreter |
Organization: | at home |
References: | 95-08-132 95-08-142 |
Date: | Tue, 22 Aug 1995 11:37:52 GMT |
Lassi.Tuura@hut.fi wrote:
> If your code is strictly C++, you could use a bunch of templates. For
> each exported function and method, you create either template function
> or a template class based object. The template function itself can
> then do any conversion required (through compiler's type unification).
> All the required conversion get compiled into the program -- no
> run-time cost and if you design it well, not too much code bloat.
In fact, all you need is a template per signature. That is, you can
deal with all the procedures and member functions that have the same
signature using the same template. For example:
template<class retType, class thisType, class arg1>
retType externalCall(retType (thisType::*func)(thisType *thisArg, arg1 a1))
{
return thisArg->*func(a1);
}
> This scheme cannot handle varargs, of course. You would have to write
> special coverters or your own varargs stubs.
Varargs remain a problem, and will need assembler assistance, unless you
have valist equivalents for them, such as printf and vprintf.
--
Antoun (Tony) Kanawati
tonyk@cybercom.net
--
Return to the
comp.compilers page.
Search the
comp.compilers archives again.