From ligges at statistik.tu-dortmund.de  Tue Sep 20 19:40:24 2011
From: ligges at statistik.tu-dortmund.de (Uwe Ligges)
Date: Tue, 20 Sep 2011 19:40:24 +0200
Subject: [Rd] Is it possible to pass a function argument from R to
 compiled code in C?
In-Reply-To: <1316539595929-3827563.post@n4.nabble.com>
References: <1316539595929-3827563.post@n4.nabble.com>
Message-ID: <4E78D008.4060800@statistik.tu-dortmund.de>

You can evaluate R functions from C, see Writing R Extension.

Uwe Ligges


On 20.09.2011 19:26, Alireza Mahani wrote:
> I have a function in R that takes another function as argument:
>
> f<- function(g, ...) { #g is expected to be a function
> }
>
> I want to see if there is a way to implement "f" in C and calling it from R
> using ".C" interface. I know that I can use function pointers for my C
> implementation, but I imagine it's going to be nearly impossible to pass a
> function from R to C. Are there any exact or approximate solutions
> available?
>
> Thank you,
> Alireza Mahani
>
>
> --
> View this message in context: http://r.789695.n4.nabble.com/Is-it-possible-to-pass-a-function-argument-from-R-to-compiled-code-in-C-tp3827563p3827563.html
> Sent from the R devel mailing list archive at Nabble.com.
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel



[Rd] Is it possible to pass a function argument from R to compiled code in C?
Uwe Ligges