Mail Archives: djgpp/1997/07/22/11:01:13
You wrote:
>One quick question. If I have a pointer that points a function, what is the
>syntax of calling the procedure via the pointer? Is it a simple CALL
><whatever> in ASM,
Yes. Be sure to push its args first, and adjust the stack afterwards.
> and is there a way to do it outside the bounds of ASM?
Yes.
int do_something(void)
{
printf("Hello there\n");
return 0;
}
int call_this_function(int (*f)(void))
{
int r;
r = f();
printf("Function returned %d\n",r);
return 0;
}
void top_level(void)
{
call_this_function(do_something);
}
HTH
Nate Eldredge
eldredge AT ap DOT net
- Raw text -