From murdoch at stats.uwo.ca  Tue Aug 18 13:50:07 2009
From: murdoch at stats.uwo.ca (Duncan Murdoch)
Date: Tue, 18 Aug 2009 07:50:07 -0400
Subject: [Rd] Calling C functions with value parameters
In-Reply-To: <xmrws52plho.fsf@mralx1.rsma.frb.gov>
References: <xmrws52plho.fsf@mralx1.rsma.frb.gov>
Message-ID: <4A8A956F.4020500@stats.uwo.ca>

On 17/08/2009 10:23 AM, Jeffrey J. Hallman wrote:
> One hassle I could do without is the necessity of writing C wrapper functions
> like this:
> 
> void fameInit(int *status){
>   cfmini(status);
>   return;
> }
> 
> when I want to call a library function (cfmini, in this case) that takes an
> int argument.  The .C interface only lets me pass a pointer to an int, rather
> than the int itself.
> 
> Is there any chanch that .C could be enhanced to allow passing arguments by
> value to the compiled code?  It would make some of my stuff much simpler.

What you have above doesn't work (you passed the pointer, not the 
value), but it's hardly complex.  I don't think the effort of extending 
.C in that way would be a worthwhile use of time.

Duncan Murdoch



[Rd] Calling C functions with value parameters
Duncan Murdoch