[Rcpp-devel] registerPlugin("QuantLib",.....)

André de Boer rnieuws at gmail.com
Tue Jan 20 09:01:16 CET 2015


Thanks Dirk for the reaction,

For my understanding: I have to compile RQuantLib with the right Makevars.win?

In my search on the www I found your slides for the QuantLib user meeting 2014.
Running the RQuantLib example results in: Error in LdFlags(FALSE) :
Cannot supply LdFlags as none set.
While the RcppArmadillo example gives no problem.

Thanks in advance,
André

> sessionInfo()
R version 3.1.2 (2014-10-31)
Platform: x86_64-w64-mingw32/x64 (64-bit)

locale:
[1] LC_COLLATE=Dutch_Netherlands.1252  LC_CTYPE=Dutch_Netherlands.1252
[3] LC_MONETARY=Dutch_Netherlands.1252 LC_NUMERIC=C
[5] LC_TIME=Dutch_Netherlands.1252

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] RQuantLib_0.4.0

loaded via a namespace (and not attached):
[1] Rcpp_0.11.2             RcppArmadillo_0.4.400.0 tools_3.1.2

2015-01-19 19:58 GMT+01:00 Dirk Eddelbuettel <edd at debian.org>:
>
> On 19 January 2015 at 19:36, André de Boer wrote:
> | Hi,
> |
> | I try to run this code in RStudio
> |
> | // Original Klaus Spanderen  R/Finance 2013: Applied Finance with R
> | library(Rcpp)
> | library(inline)
> |
> | registerPlugin("QuantLib",
> |   Rcpp:::Rcpp.plugin.maker(include.before='#include <ql/quantlib.hpp>',
> |                            libs="-lQuantLib"))
> |
> | blackFormulaCall <- cxxfunction(
> |   signature(strike="numeric", fwd="numeric",
> |             stdDev="numeric", discount="numeric"),
> |   body='
> |     using namespace QuantLib;
> |     return wrap(blackFormula(Option::Call,
> |                              as<Real>(strike), as<Real>(fwd),
> |                              as<Real>(stdDev), as<Real>(discount)));',
> |   plugin="QuantLib")
> |
> | But I get this error:
> |
> | Error in compileCode(f, code, language = language, verbose = verbose) :
> |   Compilation ERROR, function(s)/method(s) not created! Warning message:
> | running command 'make -f "C:/PROGRA~1/R/R-31~1.2/etc/x64/Makeconf" -f
> | "C:/PROGRA~1/R/R-31~1.2/share/make/winshlib.mk"
> | SHLIB_LDFLAGS='$(SHLIB_CXXLDFLAGS)' SHLIB_LD='$(SHLIB_CXXLD)'
> | SHLIB="file29c067ef2ad7.dll" WIN=64 TCLBIN=64
> | OBJECTS="file29c067ef2ad7.o"' had status 127
> | In addition: Warning message:
> | running command 'C:/PROGRA~1/R/R-31~1.2/bin/x64/R CMD SHLIB
> | file29c067ef2ad7.cpp 2> file29c067ef2ad7.cpp.err.txt' had status 1
> |
> | I have a working version of quantlib-1.4, but how do I tell the
> | compiler where to find it?
>
> Windows is, as usual, harder.  On the other OSs, we can rely on
> quantlib-config.
>
> In RQuantLib we have this in Makevars.win:
>
>   ## The environment variable QUANTLIB_ROOT has to point to an existing build of QuantLib
>   ## With R 2.12.0 and later, we also support 32 and 64 bit builds and need to differentiate
>   PKG_CXXFLAGS=-I$(QUANTLIB_ROOT) -I../inst/include -I. -I$(BOOSTLIB) $(SHLIB_OPENMP_CFLAGS) -fpermissive
>   PKG_LIBS=-L$(QUANTLIB_ROOT)/lib${R_ARCH} -lQuantLib $(SHLIB_OPENMP_CFLAGS)
>
> I think you'd need to make up a Windows variant of the plugin.  Note that
> there is also an rquantlib-devel mailing list...
>
> Dirk
>
> --
> http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org


More information about the Rcpp-devel mailing list