I'm searching for answers to four questions (I've been searching the net for hours...) In Windows XP, is it possible to call R functions from a c program? (I've found examples for Linux/Unix but not Windows) If so, is there a simple example to get started using gcc with R-2.10.0? If so, is it possible to write a simple interface using a c dll to call R functions from a Visual Basic.net program? If so, is there a simple example? Thanks to all -- View this message in context: http://n4.nabble.com/Calling-R-from-c-in-Windows-XP-tp1693440p1693440.html Sent from the R help mailing list archive at Nabble.com.
Have you looked at RInside ? -k On Sat, Mar 27, 2010 at 10:53 AM, dkStevens <david.stevens at usu.edu> wrote:> > I'm searching for answers to four questions (I've been searching the net for > hours...) > > In Windows XP, is it possible to call R functions from a c program? (I've > found examples for Linux/Unix but not Windows) > > If so, is there a simple example to get started using gcc with R-2.10.0? > > If so, is it possible to write a simple interface using a c dll to call R > functions from a Visual Basic.net program? > > If so, is there a simple example? > > Thanks to all > -- > View this message in context: http://n4.nabble.com/Calling-R-from-c-in-Windows-XP-tp1693440p1693440.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >
If you want to call R from within VB.NET you might want to look at the statconnDCOM server (available at rcom.univie.ac.at) It wraps R into a (D)COM server and therefore allows any (D)COM client to access R on windows. VB.NET is a (D)COM client. On 3/27/2010 3:53 PM, dkStevens wrote:> > I'm searching for answers to four questions (I've been searching the net for > hours...) > > In Windows XP, is it possible to call R functions from a c program? (I've > found examples for Linux/Unix but not Windows) > > If so, is there a simple example to get started using gcc with R-2.10.0? > > If so, is it possible to write a simple interface using a c dll to call R > functions from a Visual Basic.net program? > > If so, is there a simple example? > > Thanks to all-- Erich Neuwirth, University of Vienna Faculty of Computer Science Computer Supported Didactics Working Group Visit our SunSITE at http://sunsite.univie.ac.at Phone: +43-1-4277-39464 Fax: +43-1-4277-39459
On 03/27/2010 07:53 AM, dkStevens wrote:> > I'm searching for answers to four questions (I've been searching the net for > hours...) > > In Windows XP, is it possible to call R functions from a c program? (I've > found examples for Linux/Unix but not Windows) > > If so, is there a simple example to get started using gcc with R-2.10.0?Up to this point, the answer is in Writing R Extensions, sections 8.1 and 8.2 (which has a kind of implicit dependency on 8.1). A minimal file might be embed_win.c: #include <Rembedded.h> int main(int argc, char *argv[]) { Rf_initEmbeddedR(argc, argv); run_Rmainloop(); Rf_endEmbeddedR(0); return 0; } and after discovering appropriate compiler args with R CMD config --cppflags R CMD config --ldflags one might (modulo line wrapping in email clients :() Z:\Home\tmp>gcc -IC:/PROGRA~1/R/R-211~1.0DE/include -LC:/PROGRA~1/R/R-211~1.0DE/bin -lR embed_win.c and then Z:\Home\tmp>a --vanilla> x = 1:10 > q()There are more examples in https://svn.r-project.org/R/trunk/tests/Embedding Martin> > If so, is it possible to write a simple interface using a c dll to call R > functions from a Visual Basic.net program? > > If so, is there a simple example? > > Thanks to all-- Martin Morgan Computational Biology / Fred Hutchinson Cancer Research Center 1100 Fairview Ave. N. PO Box 19024 Seattle, WA 98109 Location: Arnold Building M1 B861 Phone: (206) 667-2793