From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19193 invoked by alias); 29 Jul 2003 01:29:36 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 19186 invoked from network); 29 Jul 2003 01:29:35 -0000 Received: from unknown (HELO mulga.cs.mu.OZ.AU) (128.250.1.22) by sources.redhat.com with SMTP; 29 Jul 2003 01:29:35 -0000 Received: from ceres.cs.mu.oz.au (ceres.cs.mu.OZ.AU [128.250.33.10]) by mulga.cs.mu.OZ.AU with ESMTP id LAA13439; Tue, 29 Jul 2003 11:29:28 +1000 (EST) Received: from fjh by ceres.cs.mu.oz.au with local (Exim 3.35 #1 (Debian)) id 19hJIt-0006NU-00; Tue, 29 Jul 2003 11:29:27 +1000 Date: Tue, 29 Jul 2003 09:52:00 -0000 From: Fergus Henderson To: Camm Maguire Cc: gcc@gcc.gnu.org, gcl-devel@gnu.org, axiom-developer@nongnu.org Subject: Re: portable cdecl 'elliptic' function calls Message-ID: <20030729012927.GA24209@ceres.cs.mu.oz.au> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.3.28i X-SW-Source: 2003-07/txt/msg01949.txt.bz2 On 28-Jul-2003, Camm Maguire 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 | "I have always known that the pursuit The University of Melbourne | of excellence is a lethal habit" WWW: | -- the last words of T. S. Garp.