Related articles |
---|
representing functions with arguments in an abstract syntax tree melkorainur@yahoo.com (2003-12-27) |
Re: representing functions with arguments in an abstract syntax tree torek@torek.net (Chris Torek) (2004-01-02) |
Re: representing functions with arguments in an abstract syntax tree malcolm@55bank.freeserve.co.uk (Malcolm) (2004-01-02) |
Re: representing functions with arguments in an abstract syntax tree cfc@world.std.com (Chris F Clark) (2004-01-02) |
Re: representing functions with arguments in an abstract syntax tree jacob@jacob.remcomp.fr (jacob navia) (2004-01-02) |
Re: representing functions with arguments in an abstract syntax tree witness@t-online.de (Uli Kusterer) (2004-01-02) |
From: | "Malcolm" <malcolm@55bank.freeserve.co.uk> |
Newsgroups: | comp.compilers,comp.lang.c |
Date: | 2 Jan 2004 03:40:13 -0500 |
Organization: | Compilers Central |
References: | 03-12-142 |
Keywords: | code |
Posted-Date: | 02 Jan 2004 03:40:13 EST |
"Melkor Ainur" <melkorainur@yahoo.com> wrote in message
> I write a generic function pointer that can
> represent all my different functions. some that have multiple
> promotable-arguments (chars, ints) and pointers. and then, how do I
> Pass these functions their arguments? I currently suspect I can't do
> that within C and that I might need to generate architecture specific
> assembly to store the arguments on the stack and then call the builtin
> function.
Your suspicion is right. You want to write a C function like this
void call_function(char *argtypes, void (*fptr)(), ...)
{
/* use information in argtypes to call fptr with arguments */
}
Unfortunately it can't be done in ANSI C. It's not too difficult to do
in assembly language however, as long as you know the calling
convention.
Return to the
comp.compilers page.
Search the
comp.compilers archives again.