public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: "David Janssens" <dja@info.ucl.ac.be>
To: <gcc-help@gnu.org>
Subject: implementation problem in C
Date: Thu, 30 Jan 2003 15:09:00 -0000	[thread overview]
Message-ID: <00fc01c2c871$e7b1e410$4be56882@atlas.info.ucl.ac.be> (raw)

Can someone please help me with this simple implementation problem in C:

I have a table in which each entry designates a pointer to some function,
the number of argument it expects and if it returns a value:

typedef struct {
    void *func;
    int argc, ret;
} call_t;

call_t call_table[]={
    {func1, 3, 0},
    {func2, 2, 1},
    {func3, 3, 1},
    ...
}

Now suppose that I have the index to the function I want to call and all the
values of the parameters required, how do I call this function with the
proper parameters passed?
In C, I know how to call a function from a function pointer if the number of
arguments is known statically. But in this case, the number of arguments in
known only dynamically.

thanks,
David

             reply	other threads:[~2003-01-30 15:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-01-30 15:09 David Janssens [this message]
2003-01-30 15:23 ` Momchil Velikov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='00fc01c2c871$e7b1e410$4be56882@atlas.info.ucl.ac.be' \
    --to=dja@info.ucl.ac.be \
    --cc=gcc-help@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).