Hi, I know that it is possible to use C++ functions under the R environment. In any case my intention is the opposite way: use R functions like "glm" or "lm" in my C++ code. How should I deal with this problem? Josep. -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
In either direction, you need to use C-style linking. Lookup the "extern C" directive in a C++ language reference. In the R-extensions manual, there is some example code for evaluating R expressions within C/C++. Tim On Thu, 2002-04-18 at 08:00, Josep Perarnau i Codina wrote:> Hi, > > I know that it is possible to use C++ functions under the R environment. > In any case my intention is the opposite way: use R functions like "glm" > or "lm" in my C++ code. How should I deal with this problem? > > Josep. > > -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- > r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html > Send "info", "help", or "[un]subscribe" > (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch > _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
On Thu, 18 Apr 2002, Josep Perarnau i Codina wrote:> Hi, > > I know that it is possible to use C++ functions under the R environment. > In any case my intention is the opposite way: use R functions like "glm" > or "lm" in my C++ code. How should I deal with this problem? >There's more than one way, and it depends on your application and your operating system which is best. * You could write an R program that calls the C++ program, which then calls back to R as needed. * Under Windows you could use the DCOM interface * Under Unix you could use the embedded R library -thomas Thomas Lumley Asst. Professor, Biostatistics tlumley at u.washington.edu University of Washington, Seattle -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._