[Rcpp-devel] Working with modules

Wagner Bonat wbonat at gmail.com
Thu Jun 4 16:35:25 CEST 2015


Dear all,

I am reading the Rcpp book Chapter 7 - Modules

The first example provide a C++ function

## C++ function
double norm( double x, double y){
        return sqrt(x*x + y*y);
}

## Simple wrapper function
using namespace Rcpp;
RcppExport SEXP norm_wrapper(SEXP x_, SEXP_y){
    double x = as<double>(x_), y = as<double>(y_);
    double res = norm(x,y);
    return wrap(res);
}

So, I have these two functions. But, I am lost, what should I do now?

The goal is make the function norm available in R.

Probably, this is a very basic question, so if anyone know some material on
the internet that explain the missing parts here, please let me know.

Thank you.




-- 
Wagner Hugo Bonat
----------------------------------------------------------------------------------------------
Department of Mathematics and Computer Science (IMADA)
University of Southern Denmark (SDU) and
Laboratório de Estatística e Geoinformação (LEG)
Universidade Federal do Paraná (UFPR)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20150604/5a3c24a6/attachment.html>


More information about the Rcpp-devel mailing list