Le 30/01/12 21:38, Dirk Eddelbuettel a ?crit :
On 30 January 2012 at 18:42, Sacha Epskamp wrote:
| Last year I have written some functions for my then supervisor using
| Rcpp and inline, which worked fine. Recently my supervisor got a new
| Mac, and the functions don't work anymore.
|
| After some trying I found at least one thing that wasn't working
| properly. As an example see this function:
|
| library("inline")
| library("Rcpp")
|
| fun<-cxxfunction(, '
| NumericVector foo(3,1.0);
| return wrap(foo);
| ',plugin="Rcpp")
|
| fun()
|
| This returns the vector (1,1,1) for me, but numeric(0) for my
| supervisor (compiling seems to go fine and functions work with objects
Are you both using Rcpp 0.9.9?
Could it be that he has another version hiding in his .libPaths?
Your sample works fine for me too, as it should. (You can skip the
library(Rcpp) which inline will do for us with the given plugin for Rcpp,
and
there is no need for wrap() of an Rcpp vector type.)
Dirk
Works for me too. Did you install Rcpp from source ? Maybe that would do the
trick.
Romain
| like double). I have no idea what is going wrong. I realize this is
| probably a very system-specific problem that is hard to "fix" through
| mail, but I am hoping that you might have some ideas on what might go
| wrong or a place to start.
|
| Below are some system specifications.
|
| Best,
| Sacha Epskamp
|
| system("g++ --version")
| i686-apple-darwin11-llvm-g++-4.2 (GCC) 4.2.1 (Based on Apple Inc.
| build 5658) (LLVM build 2336.1.00)
| Copyright (C) 2007 Free Software Foundation, Inc.
| This is free software; see the source for copying conditions. ?There is
NO
| warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.
|
|> ?R.version
| ? ? ? ? ? ? ? ?_
| platform ? ? ? x86_64-apple-darwin9.8.0
| arch ? ? ? ? ? x86_64
| os ? ? ? ? ? ? darwin9.8.0
| system ? ? ? ? x86_64, darwin9.8.0
| status
| major ? ? ? ? ?2
| minor ? ? ? ? ?14.1
| year ? ? ? ? ? 2011
| month ? ? ? ? ?12
| day ? ? ? ? ? ?22
| svn rev ? ? ? ?57956
| language ? ? ? R
| version.string R version 2.14.1 (2011-12-22)
|> ?packageDescription("Rcpp")$Version
| [1] "0.9.9"
| _______________________________________________
| Rcpp-devel mailing list
| Rcpp-devel at lists.r-forge.r-project.org
| https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel