inline 0.3.6

July 30, 2010
By

(This article was first published on Romain Francois, Professional R Enthusiast, and kindly contributed to R-bloggers)

I released inline 0.3.6 yesterday. This is a minor release which gives better R level errors when there is a compiler error. For example :

> tryCatch( cxxfunction( , 'int x = 3 ; x+ ; return R_NilValue ; ' ), error = function(e) print(e$message))
file10d63af1.cpp: In function ‘SEXPREC* file10d63af1()’:
file10d63af1.cpp:18: error: expected primary-expression before ‘;’ token
make: *** [file10d63af1.o] Error 1

ERROR(s) during compilation: source code errors or compiler configuration errors!

Program source:
  1: // includes from the plugin
  2: #include <R.h>
  3: #include <Rdefines.h>
  4: #include <R_ext/Error.h>
  5: 
  6: 
  7: // user includes
  8: 
  9: 
 10: // declaration
 11: extern "C" {
 12: SEXP file10d63af1( ) ;
 13: }
 14: 
 15: // definition
 16: 
 17: SEXP file10d63af1(  ){
 18: int x = 3 ; x+ ; return R_NilValue ;  
 19: Rf_warning("your C++ program does not return anything"); 
 20:  return R_NilValue ; 
 21: }
 22: 
 23: 
[1] "Compilation ERROR, function(s)/method(s) not created! file10d63af1.cpp: In function ‘SEXPREC* file10d63af1()’:\nfile10d63af1.cpp:18: error: expected primary-expression before ‘;’ token\nmake: *** [file10d63af1.o] Error 1"

The compile error is part of the message of the R error, with previous versions, the R error always had the same message “Compilation ERROR, function(s)/method(s) not created!”.

This will be especially useful for developing Rcpp, which rely on inline for unit testing

To leave a comment for the author, please follow the link and comment on their blog: Romain Francois, Professional R Enthusiast.

R-bloggers.com offers daily e-mail updates about R news and tutorials on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...



If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Tags: , ,

Comments are closed.

Sponsors

Mango solutions



RStudio homepage



Zero Inflated Models and Generalized Linear Mixed Models with R

Quantide: statistical consulting and training



http://www.eoda.de







ODSC

ODSC

CRC R books series











Contact us if you wish to help support R-bloggers, and place your banner here.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)