# Rffi

**Omegahat Statistical Computing » R**, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)

Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

A few weeks ago, I posted the Rffi package on the Omegahat repository.

It is an interface to libffi which is a portable mechanism for invoking native routines

without having to write and compile any wrapper routines in the native language.

In other words, we can use this in R to call C routines using only R code.

This enables us to call arbitrary routines and get back arbitrary values, including structures

arrays, unions, etc.

One could use the RGCCTranslationUnit package to obtain descriptions of routines and data

structures and then generate the interfaces to those routines via functions in Rffi.

Writing or generating C/C++ code for wrappers (see RGCCTranslationUnit) is still the way to

go in many ways, but Rffi is very convenient for dynamic invocations without any write and compile

setup costs.

As usual, you can install this from source from the Omegahat repository

install.packages(“Rffi”, repos = “http://www.omegahat.org/R”, type = “source”)

but you will need to have installed libffi.

**leave a comment**for the author, please follow the link and comment on their blog:

**Omegahat Statistical Computing » R**.

R-bloggers.com offers

**daily e-mail updates**about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.

Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.