I would like to continue this thread regarding my latest experience with 
constructing a plugin for inline:

I followed the inline.R file in RcppArmadillo and my function looks now like 
this one:

inlineCxxPlugin <- Rcpp:::Rcpp.plugin.maker(
                                            include.before  = "#include 
<nlopt.hpp>",
                                            libs            = 
paste(nloptr::nloptrLdFlags()),
                                            package         = "nloptr", 
                                            )

where my nloptr::nloptrLdFlags() function is similar to the RcppLdFlags() 
function of the Rcpp package. Constructing everything was pretty easy. I tested 
everything in R and I get no errors. Though, I get two warnings of the type:

In file(con, "r") :
  file("") only supports open = "w+" and open = "w+b": using the former

I am very unsure if this is produced by the function of the inline package or 
rather due to a certain setting of my system. I debugged the readLines function 
and I can tell, that this function is called at least three times on the 
certain connection 'con'. The first two times con = "" and the warnings are 
produced. The third time con = "file20c62a48c701.cpp.err.txt" and no warning 
occurs.

Does anyone have an explanation what is going on and if I might have forgotten 
something in my code? 


Best

Simon

On Oct 12, 2013, at 9:55 AM, Simon Zehnder <[email protected]> wrote:

> Hi J.J.,
> 
> that makes it precise! As I see now also in RcppArmadillo the naming 
> inlineCxxPlugin is used and this is the 'identifier' as you say. Great! I 
> modify my code to make use of this pattern.
> 
> Thank you for your response!
> 
> Simon
> 
> On Oct 12, 2013, at 1:01 AM, JJ Allaire <[email protected]> wrote:
> 
>> Simon,
>> 
>> To make a plugin available for use with both inline and Rcpp attributes you 
>> need only define a function named "inlineCxxPlugin" within your package 
>> (which can in turn call Rcpp.plugin.maker). This allow you to use it with 
>> inline as well as Rcpp::depends.
>> 
>> I think this is the scenario you are targeting (since you are writing a 
>> package). The registerPlugin function is used when you want to make 
>> available a plugin that isn't part of a package (e.g. for some type of 
>> ad-hoc complier/linker recipe you need to cook up).
>> 
>> J.J.
>> 
>> 
>> On Fri, Oct 11, 2013 at 5:54 PM, Dirk Eddelbuettel <[email protected]> wrote:
>> 
>> Simon,
>> 
>> On 11 October 2013 at 23:43, Simon Zehnder wrote:
>> | I have a very short question in regard to plugins in packages. I have 
>> written my own plugin using Rcpp.plugin.maker (very well documented in FAQ 
>> btw).
>> |
>> | I know, that on the command line calling registerPlugin() registers the 
>> plugin. From RcppArmadillo I can see, that the registerPlugin function is 
>> never called inside the package - but I see also, that the file is called 
>> inline.R. How does the inline package register/identify a plugin? Is a 
>> plugin registered automatically when called inside cxxfunction? Does it have 
>> to be put into a file called 'inline.R'?
>> 
>> What is your actual intent?  To support inline? To support Rcpp Attributes?
>> 
>> I have not looked at this in a while, but I think we may not actually
>> required registration (ie there is no run-time state vector accumulating
>> plugin callbacks...) but when a plugin is invoked, it points to a package and
>> hence the package namespace is searched and a corresponding function is
>> called.
>> 
>> This is from memory. Actual details may differ. Void where prohibited :)
>> 
>> Dirk
>> 
>> --
>> Dirk Eddelbuettel | [email protected] | http://dirk.eddelbuettel.com
>> _______________________________________________
>> Rcpp-devel mailing list
>> [email protected]
>> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
>> 
> 
> _______________________________________________
> Rcpp-devel mailing list
> [email protected]
> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel

_______________________________________________
Rcpp-devel mailing list
[email protected]
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel

Reply via email to