Re: [Rcpp-devel] Re-using C++ code from a package with modules and defining linker flags using Rscript

2011-05-16 Thread Jelmer Ypma
Thanks for both your replies. I got it working the way I wanted. If someone's interested, a simple example with two packages can be downloaded here: http://www.ucl.ac.uk/~uctpjyy/downloads/RcppEx.zip QuadFunc defines a C++ class that is used in C++ code in QuadFuncVec. Jelmer On Mon, May 16, 201

Re: [Rcpp-devel] Exposing constructors with same number of arguments with different types using Rcpp Modules

2011-05-16 Thread Romain Francois
There is a mechanism for dispatching to the appropriate constructor, but this needs extra work from you on the C++ side. I'm currently not entirely happy about it, and this might change in the future for something nicer. Some information about it was posted on this thread: http://article.gmane

[Rcpp-devel] Function does not compile on Mac OSX

2011-05-16 Thread Sacha Epskamp
Dear mailing list, For a project I am working on speeding up a simulation in R by translating it to C++ (using inline and Rcpp). It is done and works fine on my windows 7 64bit R, but for some reason it is not working on my supervisors latest mac OSX (not sure of the version. should be up to date)

Re: [Rcpp-devel] Re-using C++ code from a package with modules and defining linker flags using Rscript

2011-05-16 Thread Dirk Eddelbuettel
On 16 May 2011 at 10:28, Jelmer Ypma wrote: | Thanks for both your replies. I got it working the way I wanted. If | someone's interested, a simple example with two packages can be | downloaded here: http://www.ucl.ac.uk/~uctpjyy/downloads/RcppEx.zip | | QuadFunc defines a C++ class that is used i

Re: [Rcpp-devel] Function does not compile on Mac OSX

2011-05-16 Thread Romain Francois
Hello, Let's try to narrow this down. Please provide a small and reproducible example. What is the version of the compiler. This is what I have on my iMac: $ g++ --version i686-apple-darwin10-g++-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5666) (dot 3) Copyright (C) 2007 Free Software Foundation, Inc.

Re: [Rcpp-devel] Re-using C++ code from a package with modules and defining linker flags using Rscript

2011-05-16 Thread Jelmer Ypma
Hi Dirk, thanks for your reply. > PS Also try > > -e "QuadFunc:::CxxFlags()") > > instead of > > -e "library(QuadFunc); QuadFunc:::CxxFlags()") > > as the ::: finds unexported symbols, that usually works from unloaded > packages too. It works for unloaded packages that don't use module

Re: [Rcpp-devel] Exposing constructors with same number of arguments with different types using Rcpp Modules

2011-05-16 Thread Jelmer Ypma
Thanks, this works for me. Jelmer On Mon, May 16, 2011 at 10:33, Romain Francois wrote: > There is a mechanism for dispatching to the appropriate constructor, but > this needs extra work from you on the C++ side. I'm currently not entirely > happy about it, and this might change in the future fo

Re: [Rcpp-devel] Re-using C++ code from a package with modules and defining linker flags using Rscript

2011-05-16 Thread Dirk Eddelbuettel
Hi Jelmer, On 16 May 2011 at 14:00, Jelmer Ypma wrote: | Hi Dirk, | | thanks for your reply. | | > PS Also try | > | > -e "QuadFunc:::CxxFlags()") | > | > instead of | > | > -e "library(QuadFunc); QuadFunc:::CxxFlags()") | > | > as the ::: finds unexported symbols, that usually works fr

Re: [Rcpp-devel] Function does not compile on Mac OSX

2011-05-16 Thread Sacha Epskamp
Hi, Here is a small example: library("Rcpp") library("inline") fun <-cxxfunction(, ' Environment e = Environment::global_env(); NumericVector bar = e["foo"]; bar = bar + 1; return wrap(bar); ',plugin="Rcpp") foo <- 1:10 fun() This function works fine on my windows netbook, but does not work

Re: [Rcpp-devel] Function does not compile on Mac OSX

2011-05-16 Thread Sacha Epskamp
And the error he gets is: Error in compileCode(f, code, language = language, verbose = verbose) : Compilation ERROR, function(s)/method(s) not created! file786264e8.cpp: In function ‘SEXPREC* file786264e8()’: file786264e8.cpp:33: error: ISO C++ says that these are ambiguous, even though the wors

Re: [Rcpp-devel] Function does not compile on Mac OSX

2011-05-16 Thread Steve Lianoglou
Hi, For what it's worth, your code works fine on my mac: R> ... your code ... R> fun() [1] 2 3 4 5 6 7 8 9 10 11 R> sessionInfo() R version 2.13.0 Patched (2011-05-11 r55852) Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit) ... Also: $ g++ --version i686-apple-darwin10-g++-4.2.1 (GC

Re: [Rcpp-devel] Re-using C++ code from a package with modules and defining linker flags using Rscript

2011-05-16 Thread Jelmer Ypma
Hi Dirk, yes, this makes sense, thanks. I originally added the CxxFlags(), because one of the packages I'm linking to defines where to find the Boost headers, but I see that it's not needed in all cases. Thanks! Jelmer On Mon, May 16, 2011 at 15:26, Dirk Eddelbuettel wrote: > > Hi Jelmer, > > O

Re: [Rcpp-devel] Rcpp-devel Digest, Vol 19, Issue 10

2011-05-16 Thread Davor Cubranic
It's Romain's trick, really, as you can see from the thread Dirk mentioned. I was just the first to use it in a CRAN package. Davor On 2011-05-15, at 7:04 AM, Dirk Eddelbuettel wrote: > > On 15 May 2011 at 01:43, Christian Gunning wrote: > | On Sat, May 14, 2011 at 6:46 PM, > | wrote: > | > >

Re: [Rcpp-devel] Re-using C++ code from a package with modules and defining linker flags using Rscript

2011-05-16 Thread Dirk Eddelbuettel
Hi Jelmer, On 16 May 2011 at 21:47, Jelmer Ypma wrote: | yes, this makes sense, thanks. I originally added the CxxFlags(), | because one of the packages I'm linking to defines where to find the | Boost headers, but I see that it's not needed in all cases. Yes, sure, there can be many reasons to