D-Link with R/MATLAB/Julia/SQL

Joseph Rushton Wakeling joseph.wakeling at webdrake.net
Sat Dec 7 09:08:32 PST 2013


On 06/12/13 03:16, bachmeier wrote:
> I have been using R and D together for several months. It is easy to embed
> either inside the other. Unfortunately I have not found the time to write up any
> decent notes about it. With the latest release of DMD, my workflow is to create
> shared libraries with D and call them from R. Using the .C interface from R is
> simple, but not much fun. I wrote up a few notes here:
>
> http://lancebachmeier.com/wiki/doku.php?id=rlang:calling-d

That's very cool, and also something of a relief to see, as I think interfacing 
nicely with R is an essential feature for a programming language in some domains 
of research.

> What I've been working on lately is a .Call-based interface that provides some
> of the same convenience as Rcpp. I call into Gretl's C API to get a wide range
> of econometric functions. It works well enough that I'm going to give a lecture
> to my graduate students on calling D functions from R next week.
>
> To embed R inside D, which is maybe more what you're after, I created a simple C
> interface to RInside. That works well. Unfortunately I don't have notes on that
> either.
>
> I'll be happy to share more if any of this will help you.

I think that you would be doing everyone a big favour if you would provide a 
good writeup on this.  Can I also suggest making a talk proposal to DConf 2014 
about this work?

Question: I remember a colleague who had worked on linking a C library into R 
telling me that he'd had to make copies of data before passing into R, because R 
expects variables to be immutable.  Is there anything that you can do with D's 
support for immutability that lets you avoid this?  Or are you constrained by 
the fact that you need to use an extern(C) API?


More information about the Digitalmars-d mailing list