This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: portable cdecl 'elliptic' function calls


On 28-Jul-2003, Camm Maguire <camm@enhanced.com> wrote:
> object
> c_apply_n(object (*fn)(), int n, object *x)
> {object res=Cnil;
> #if 1
>  object *stack;
> 
>  if (!(stack=alloca(n*sizeof(*stack))))
>    FEerror("Cannot allocate stack for elliptic call", 0);
>  memcpy(stack,x,n*sizeof(*stack));
>  res=fn();

This code is extremely non-portable.

I suggest you try using libffi, which is included in the GCC sources.
See libffi/README.

-- 
Fergus Henderson <fjh@cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]