
140 CHAPTER 5. SHARED-MEMORY: C
return outmshort ;
}
5.5.5 Compiling and Running
We will still run R CMD SHLIB to compile, but we have more libraries
to specify in this case. In the bash shell, we can run
export R_LIBS_USER=/home/nm/R
export PKG_LIBS="-lgomp"
export PKG_CXXFLAGS="-fopenmp -I/home/nm/R/Rcpp/include"
That first command lets R know where our R packages are, in this case the
Rcpp package. The second states we need to link in the gomp library,
which is for OpenMP, and the third both warns the compiler to watch for
OpenMP pragmas and to include the Rcpp header files.
Note that that last export assumes our source code is in C++, as indicated
belo ...