[Rcpp-devel] Are c++ vector types provided by Rccp real c++ type?

Héloïse Gauvin heloise.gauvin at gmail.com
Tue Jun 7 17:44:49 CEST 2011


Hi,

I am a new user of Rccp. I've been trying to understand since 2 weeks how
I'll be able to convert a Splus library constructed with multiple C++
functions (and files)  into a nice and free R package.

My question seems basic to me but I'll let you judge I get this error
message:

interface.cpp: In function 'SEXPREC* CreateObjectGen(SEXPREC*, SEXPREC*, S
EXPREC*, SEXPREC*)':
interface.cpp:115:87: error: cannot convert 'Rcpp::Fast<Rcpp::Vector<14> >'
to
'int*' for argument '1' to 'int CompGen(int*, int*, int*, int*, int*, int*,
int*, int*, int*)'

Do this mean I have to modify every function I am calling from inside
another c++ function? Is it possible?

Here I have this code:
__________

#include"outils.h" // 'outils.cpp' is the place where the function CompGen()
is

#include "interface.h"

#include <stdlib.h>

using namespace Rcpp ;

RcppExport SEXP CreerObjetGen(SEXP SInd,SEXP SPere, SEXP SMere, SEXP SSexe)
{
    STARTTIMER;

    NumericVector xSInd(SInd),  xSPere(SPere),  xSMere(SMere),
xSSexe(SSexe);
    Fast<NumericVector> fSIndividu(xSIndividu), fSPere(xSPere),
fSMere(xSMere) , fSSexe(xSSexe);

 ....
    CompGen(fSInd,fSPere,fSMere,fSSexe,fInd,fpere,fmere,fsexe,&lNIndividu);
//  the 2nd function I called...
__________

I used to have this before I had to change them to types provided by Rccp
(NumericVector):

 int* plIndividu    =INTEGER_POINTER(AS_INTEGER(SIndividu));
    int* plPere        =INTEGER_POINTER(AS_INTEGER(SPere));
  etc...


I've also read the last post on the list... is it because I can't send
pointers through a function?

thanks for the help,

Héloïse


-- 
Héloïse Gauvin
PhD student, Epidemiology
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20110607/8f194873/attachment.htm>


More information about the Rcpp-devel mailing list