[R] Calling R functions into C# or C++
Dieter Menne
dieter.menne at menne-biomed.de
Thu Jun 19 09:48:07 CEST 2008
Shubha Vishwanath Karanth <shubhak <at> ambaresearch.com> 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.
http://mailman.csd.univie.ac.at/mailman/listinfo/rcom-l
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
More information about the R-help
mailing list