From alireza.s.mahani at gmail.com  Tue Sep 20 20:07:26 2011
From: alireza.s.mahani at gmail.com (Alireza Mahani)
Date: Tue, 20 Sep 2011 11:07:26 -0700 (PDT)
Subject: [Rd] Is it possible to pass a function argument from R to
 compiled code in C?
In-Reply-To: <CADwqtCPWD5CXk_TKW10Nsy+GbAML9AAZaMm+J3zSzuhVS5KizA@mail.gmail.com>
References: <1316539595929-3827563.post@n4.nabble.com>
	<4E78D008.4060800@statistik.tu-dortmund.de>
	<CADwqtCPWD5CXk_TKW10Nsy+GbAML9AAZaMm+J3zSzuhVS5KizA@mail.gmail.com>
Message-ID: <1316542046079-3827690.post@n4.nabble.com>

OK, thanks. But there are two issues with using ".Call":

1- I may give up performance if I am literally running R code inside C,
right? In some ways, wouldn't it defy the purpose of calling a compiled code
if I end up back in R?

2- If I use the ".Call" interface, the resulting code will be tailored to R,
i.e. I will end up having the lengthy code with all the R macros in it. I
always prefer to use ".C" interface because I can use the exact same piece
of code inside of a C program, i.e. I can call the same function either from
R or from C. But with .Call, I am passing R's pointers into the function,
which obviously I won't be doing when my call comes from inside of C.

Nevertheless, it's good to know that there is at least a sub-optimal
solution out there (sub-optimal from my perspective, of course!).

-Alireza

--
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-tp3827563p3827690.html
Sent from the R devel mailing list archive at Nabble.com.



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