Skip to content

Commit 67aff9e

Browse files
committed
some documentation updates in the FAQ vignette
1 parent 9bf5d2d commit 67aff9e

File tree

3 files changed

+71
-19
lines changed

3 files changed

+71
-19
lines changed

ChangeLog

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
2014-01-28 Dirk Eddelbuettel <[email protected]>
2+
3+
* vignettes/Rcpp-FAQ.Rnw: Some updates for upcoming release
4+
15
2014-01-25 Dirk Eddelbuettel <[email protected]>
26

37
* inst/include/Rcpp/Benchmark/Timer.h: Simplified -- Rcpp Gallery

inst/NEWS.Rd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
\title{News for Package 'Rcpp'}
33
\newcommand{\cpkg}{\href{http://CRAN.R-project.org/package=#1}{\pkg{#1}}}
44

5-
\section{Changes in [unreleased] Rcpp version 0.10.7 (2013-11-30)}{
5+
\section{Changes in [unreleased] Rcpp version 0.11.0 (2014-02-03)}{
66
\itemize{
77
\item Changes in Rcpp API:
88
\itemize{

vignettes/Rcpp-FAQ.Rnw

Lines changed: 66 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,12 @@ vignette( "Rcpp-package" )
182182
@
183183

184184
\subsection{How do I quickly prototype my code?}
185+
186+
There are two toolchains which can help with this. The older one is provided
187+
by the \pkg{inline} package and described in Section~\ref{using-inline}.
188+
Starting with \pkg{Rcpp} 0.10.0, the Rcpp Attributes feature offered an even
189+
easier alternative. It is described in Section~\ref{using-attributes}.
190+
185191
\subsubsection{Using inline}
186192
\label{using-inline}
187193

@@ -224,7 +230,8 @@ useful as it shows how \pkg{inline} runs the show.
224230
\subsubsection{Using Rcpp Attributes}
225231
\label{using-attributes}
226232

227-
Rcpp Attributes \citep{CRAN:Rcpp:Attributes}, discussed in \faq{using-attributes} below, permits an even easier
233+
Rcpp Attributes \citep{CRAN:Rcpp:Attributes}, and also discussed in
234+
\faq{prototype-using-attributes} below, permits an even easier
228235
route to integrating R and C++. It provides three key functions. First, \code{evalCpp}
229236
provide a means to evaluate simple C++ expression which is often useful for
230237
small tests, or to simply check if the toolchain is set up
@@ -257,6 +264,10 @@ transform a prototyped function into the minimal structure of a package.
257264
After that you can proceed with working on the package in the spirit of
258265
\faq{make-package}.
259266

267+
Rcpp Attributes \citep{CRAN:Rcpp:Attributes} also offers a means to convert
268+
functions written using Rcpp Attributes into a function via the
269+
\code{compileAttributes()} function; see the vignette for details.
270+
260271
\subsection{How do I quickly prototype my code in a package?}
261272
\label{using-a-package}
262273

@@ -289,6 +300,9 @@ The example then becomes
289300
The \code{-l} option calls 'suppressMessages(library(mypkg))' before executing the
290301
\proglang{R} expression. Several packages can be listed, separated by a comma.
291302

303+
More choice are provide by the \pkg{devtools} package, and by using
304+
RStudio. See the respective documentation for details.
305+
292306
\subsection{But I want to compile my code with R CMD SHLIB !}
293307
\label{using-r-cmd-shlib}
294308

@@ -347,7 +361,10 @@ user. How to do so has been shown above, and we recommned you use either
347361
function \texttt{Rcpp:::LdFlags()}.
348362

349363
If and when \texttt{LinkingTo} changes and lives up to its name, we will be
350-
sure to adapt \pkg{Rcpp} as well.
364+
sure to adapt \pkg{Rcpp} as well.
365+
366+
An important change arrive with \pkg{Rcpp} release 0.11.0 and concern the
367+
automatic registration of functions; see Section~\ref{function-registration} below.
351368

352369

353370
\subsection{Does \pkg{Rcpp} work on windows ?}
@@ -367,19 +384,25 @@ complain to its vendor if you are still upset.
367384
\subsection{I am having problems building Rcpp on OS X, any help ?}
368385
\label{q:OSX}
369386

370-
OS X is a little more conservative with compiler versions, so it pays to get
371-
the latest of whatever Apple releases which may already be a little behind
372-
what is used on Linux or Windows.
373-
374-
At the time of writing this paragraph (in the spring of 2011), \pkg{Rcpp}
375-
(just like CRAN) supports all OS X releases greater or equal to 10.5.
376-
However, building \pkg{Rcpp} from source (or building packages using
377-
\pkg{Rcpp}) also requires a recent-enough version of Xcode. For the
378-
\textsl{Leopard} release of OS X, the current version is 3.1.4 which can be
379-
downloaded free of charge from the Apple Developer site. Users may have to
380-
manually select \code{g++-4.2} via the symbolic link \code{/usr/bin/g++}.
381-
The \textsl{Snow Leopard} release already comes with Xcode 3.2.x and work as
382-
is.
387+
OS X used to be a little more conservative with compiler versions as Apple
388+
stuck with gcc-4.2. Following the 'Mavericks' release, it is the opposite as
389+
only llvm is provide in Xcode---while the R build provided by CRAN still has
390+
hardwired settings for the gcc/g++ combination. Until that is resolved, users
391+
either need to create softlinks (say, in, \code{/usr/local/bin}) or override
392+
the \code{CC} and \code{CXX} variables via a file \code{~/.R/Makevars} or its
393+
system-equivalent in R's \code{etc/} directory.
394+
395+
Compilation from source is recommended. See the \code{r-sig-mac} mailing for
396+
further details.
397+
%At the time of writing this paragraph (in the spring of 2011), \pkg{Rcpp}
398+
%(just like CRAN) supports all OS X releases greater or equal to 10.5.
399+
%However, building \pkg{Rcpp} from source (or building packages using
400+
%\pkg{Rcpp}) also requires a recent-enough version of Xcode. For the
401+
%\textsl{Leopard} release of OS X, the current version is 3.1.4 which can be
402+
%downloaded free of charge from the Apple Developer site. Users may have to
403+
%manually select \code{g++-4.2} via the symbolic link \code{/usr/bin/g++}.
404+
%The \textsl{Snow Leopard} release already comes with Xcode 3.2.x and work as
405+
%is.
383406

384407
\subsection{Does \pkg{Rcpp} work on solaris/suncc ?}
385408

@@ -401,7 +424,7 @@ CXXR and \pkg{Rcpp} both want \proglang{R} to make more use of \proglang{C++}
401424
but they do it in very different ways.
402425

403426
\subsection{How do I quickly prototype my code using Attributes?}
404-
\label{using-attributes}
427+
\label{prototype-using-attributes}
405428

406429
\pkg{Rcpp} version 0.10.0 and later offer a new feature 'Rcpp Attributes'
407430
which is described in detail in its own vignette
@@ -410,6 +433,30 @@ which is described in detail in its own vignette
410433
\code{cxxfunction} function.
411434

412435

436+
\subsection{What about the new 'no-linking' feature??}
437+
\label{function-registration}
438+
439+
Starting with \pkg{Rcpp} 0.11.0, functionality provided by \pkg{Rcpp} and
440+
used by packages built with \pkg{Rcpp} accessed via the registration facility
441+
offered by R (and which is used by \pkg{lme4} and \pkg{Matrix}, as well as by
442+
\pkg{xts} and \pkg{zoo}). This requires no effort from the user /
443+
programmer, and even frees us from explicit linking instruction. In most
444+
cases, the files \code{src/Makevars} and \code{src/Makevars.win} can now be
445+
removed. Exceptions are the use of \pkg{RcppArmadillo} (which needs an entry
446+
\verb|PKG_LIBS=$(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS)|) and packages linking
447+
to external libraries they use.
448+
449+
But for most packages using \pkg{Rcpp}, only two things are required:
450+
\begin{itemize}
451+
\item an entry in \code{DESCRIPTION} such as \code{Imports: Rcpp} (which may
452+
be versioned as in \code{Imports: Rcpp (>= 0.11.0)}), and
453+
\item an entry in \code{NAMESPACE} to ensure \pkg{Rcpp} is correctly
454+
instantiated, for example \code{importFrom(Rcpp, evalCpp)}.
455+
\end{itemize}
456+
457+
The name of the symbol does really matter; once one symbol is important all
458+
should be available.
459+
413460

414461
\section{Examples}
415462

@@ -456,8 +503,9 @@ fun <- cxxfunction(signature(xs="numeric", is="integer"),
456503
fun(2.2, 3L)
457504
@
458505

459-
Update: Also see \faq{using-attributes} above about 'Rcpp
460-
Attributes' \citep{CRAN:Rcpp:Attributes} and its \code{sourceCpp} function.
506+
Update: Also see \faq{using-attributes} and \faq{prototype-using-attributes}
507+
above about 'Rcpp Attributes' \citep{CRAN:Rcpp:Attributes} and its
508+
\code{sourceCpp} function.
461509

462510
\subsection{Can I do matrix algebra with \pkg{Rcpp} ?}
463511
\label{matrix-algebra}

0 commit comments

Comments
 (0)