[Rd] lbfgsb from C/C++

axionator axionator at gmail.com
Sun Sep 7 12:30:11 CEST 2014


Hi,

I would like to call R's lbfgsb function from my C/C++ code by including
R_ext/Applic.h and linking against libR.
Currently, I am allocating memory for x (and the other input arrays for
lbfgsb) in my C/C++ code via malloc/new. However, this gives a segmentation
fault when executing the program.
I tried to allocate x via PROTECT(x = NEW_NUMERIC(n)); x_p =
NUMERIC_POINTER(x);.
This compiles but also gives a segmentation fault.
Is there a way to use lbfgsb from C/C++ directly (without an intermediate
call of R)? Did I miss any compile flags?

Thanks

	[[alternative HTML version deleted]]



More information about the R-devel mailing list