This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: portable cdecl 'elliptic' function calls
- From: Camm Maguire <camm at enhanced dot com>
- To: Fergus Henderson <fjh at cs dot mu dot OZ dot AU>
- Cc: gcc at gcc dot gnu dot org, gcl-devel at gnu dot org, axiom-developer at nongnu dot org, <acl2 at lists dot cc dot utexas dot edu>, <maxima at mail dot ma dot utexas dot edu>
- Date: 30 Jul 2003 17:54:54 -0400
- Subject: Re: portable cdecl 'elliptic' function calls
- References: <E19hFdA-0003kJ-00@intech19.enhanced.com><20030729012927.GA24209@ceres.cs.mu.oz.au>
Greetings, and thank you for this tip! I now think I see how to do
this in GCL, and would like to build in dependency on libffi. Is this
available on everyone's systems? I'm assuming its packaged at least
everywhere gcc is available. What about solaris, Mac OS X?
Take care,
Fergus Henderson <fjh@cs.mu.OZ.AU> writes:
> 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.
>
>
>
--
Camm Maguire camm@enhanced.com
==========================================================================
"The earth is but one country, and mankind its citizens." -- Baha'u'llah