[Rd] Rcpp, best method for linking to

Dominick Samperi dsamperi at DecisionSynergy.com
Sat Feb 25 00:13:02 CET 2006


Andy,

Any of the options you mentioned (libRcpp.a, source, etc.) sound fine
to me. If the GPL is a problem I am happy to change this to some other
open source license (I'm not entirely comfortable with GPL, and used
it because R uses it). I'm open to suggestions.

Dominick

Andrew Garbutt wrote:
> Dominick,
>
> Sorry, that's not quite what I was asking.  I was asking more of a "best
> practice" kind of question. My own C++ codes compile fine and are
> accessible to R with some great #define magic.  I was noting that the
> Rcpp package has some generic classes to handle conversion of SEXP
> structures to STL and back again. As I far as I can see, using them
> would require that I compile the C++ code into a library and link to
> that library. Or copy the code into my own code base, but doing would
> restrict myself to the GPL, as it would be a derivative work?? (IANAL)
> At this point I do not want to commit to any particular licensure for my
> package.  
>
> So, to sum up my "actual" question... 
> Is it better to create a libRcpp.a and link to that? Have a copy of the
> Rcpp.cpp/.hpp files in my own code base compiling them directly?
> Require that any particular R installation have the requirement that the
> Rcpp package be installed prior?
>
> Thanks for your time,
> Andy
>
> -----Original Message-----
> From: Dominick Samperi [mailto:dsamperi at DecisionSynergy.com] 
> Sent: Friday, February 24, 2006 2:30 PM
> To: Andrew Finley
> Cc: Andrew Garbutt; r-devel at r-project.org
> Subject: Re: [Rd] Rcpp, best method for linking to
>
>
> Hi Andy (and Andy),
>
> I'm not sure why there should be any licensing issues. R itself is
> GPL-ed,
> so I just followed this convention.
>
> Of course, you can do it yourself with extern "C" and all that. The
> purpose of Rcpp.{cpp,hpp} is to enable you to write
> readable code (for a C++ programmer) while hiding the error-prone
> macro gymnastics that is required to fetch R parameters when using
> the .Call interface. There is also a fair amount of type checking done
> in the Rcpp package that relieves you of the trouble of putting many
> checks in your R code.
>
> If you are using the older, simpler .C interface this may not be
> important to you. But note that the same functionality is available
> through Rcpp, with the added convenience that list item names
> are not dropped like they are when you use the .C interface.
>
> Dominick
>
> Andrew Finley wrote:
>   
>> Hi Andy,
>> Follow the suggestions for c++ in the Writing R Extensions document.
>> Wrap your c++ code in extern "C"{}, include your classes in the
>>     
> includes
>   
>> (e.g., #include "myclass.h") and put the myclass.h and myclass.cpp in
>> the src directory along with your other code. Then R CMD build ... and
>>     
> R
>   
>> CMD INSTALL ...  This works for me. 
>> -Andy
>>
>>
>> On Fri, 2006-02-24 at 13:11 -0800, Andrew Garbutt wrote:
>>   
>>     
>>> Dear all,
>>>
>>>  
>>>
>>> After a bit of reading I came across the Rcpp example package.  There
>>> are a few classes that I would like to use and I am not sure how best
>>>       
> to
>   
>>> include them in my own package.  Is it best to compile it as an
>>> independent library and link to it? Or is there some way to `require`
>>>       
> it
>   
>>> for my own package?  Re-write using the code as an example (unsure
>>>       
> how
>   
>>> best to do this at this moment, as the Rcpp package is licensed under
>>> the GPL v2 and I am unsure of the license that I wish to use for my
>>>       
> own
>   
>>> package.)  Any thoughts or ideas would be appreciated.
>>>
>>>  
>>>
>>> Thanks,
>>>
>>> Andy 
>>>
>>>
>>> 	[[alternative HTML version deleted]]
>>>
>>> ______________________________________________
>>> R-devel at r-project.org mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-devel
>>>     
>>>



More information about the R-devel mailing list