Re: [R] Calling R functions into C# or C++

From: Dieter Menne <>
Date: Thu, 19 Jun 2008 07:48:07 +0000 (UTC)

Shubha Vishwanath Karanth <shubhak <at>> writes:

> Can I call R functions/routines from C# or C++? If so, how do I do this?
> Do I need to have some knowledge on DLL to do this?

You can, using R(DCOM) which is installed by the Windows installer. There is a separate list to discuss this, but it is mainly focused on Excel interaction.

When you select the full install of R(D)COM, you also get an MFC/C++ sample. C#/.NET works, I use it heavily, and you can generate nice interfaces for R with it. You must reference StatConnectorClntLib, StatconnectorCommonLib, StatConnectorSRVLib, and you get an implicit reference to AxStatConnectorClntLib. No explicitely generated DLL is required with Visual Studio, but don't expect this to work easily when you fear DLL creation.

There is a major problem with Data Excecution Prevention and installation of C# procedure calling R(D)COM with Vista which I only could get around by disabling DEP.

Dieter mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Thu 19 Jun 2008 - 07:51:21 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 19 Jun 2008 - 08:31:18 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive