From mboxrd@z Thu Jan 1 00:00:00 1970 From: Latchesar Ionkov To: 9fans@cse.psu.edu Message-ID: <20010620101105.A32668@gmx.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2i Subject: [9fans] calling function with (variable number of) parameters Date: Wed, 20 Jun 2001 10:11:05 -0400 Topicbox-Message-UUID: be1ec4be-eac9-11e9-9e20-41e7f4b1d025 Hi, I am trying to write a function int callf(void *f, int nargs, int *args) f is a pointer to a function of a type int f(int, int, int, ..., int) callf should copy nargs number of ints from args to the stack and call f, and then return f's return value. The requirement is to not restrict nargs -- theoretically f can have 1000+ arguments. Is this possible with Plan9 C calling convention? The caller function saves the registers that it needs (obviously in the stack), then SP is modified with a non-constant value, f is called, and after the execution returns in callf, there is no any way go guess, what that value was. Do I miss something? Any ideas how to implement it? Unfortunately I don't have any control on the requirements or the way f gets its parameters. If there is no way to do it for any number of args, I'll limit nargs (and hope nobody will write function with more than 15 arguments) and will modify SP with a constant value. Thanks, Lucho