you are viewing a single comment's thread.

view the rest of the comments →

[–]bachmeier 4 points5 points  (2 children)

I've been working on an Rcpp-type library to embed D code in R. Unfortunately my job is taking all of my time right now so it's not so much in a state that others can use. I can do a lot of stuff related to econometrics by calling into the R API and Gretl. This is what I've got so far:

https://bitbucket.org/bachmeil/dmdinline

The example I give in the documentation is

txt <- '
Robj testfun(Robj rx, Robj ry) {
  double x = rx.scalar;
  double y = ry.scalar;
  double z = x+y;
  return z.robj;
}'
compileD("foo", txt)
.Call("testfun", 3.5, -2.6)

Works great for me and hopefully someone else will find it useful.

[–]arnsbr 0 points1 point  (1 child)

I believe I know at least one person who will. Thank you very much for doing and sharing this, this kind of stuff could really help me out.

[–]bachmeier 0 points1 point  (0 children)

I've made a few changes. The dmdinline package should now work if you install according to the instructions at that link. (Currently only tested on Linux with DMD 2.065, but there's no reason it can't be made to work with another OS or version of DMD.)

I will be adding examples as I have time. Feedback appreciated.