I am facing difficulties in creating Rmath.dll. I have already referred to several sources:
- R-exts 6.17: Using these functions in your own C code
- R-admin 9: The standalone Rmath library
- Using the R Standalone Math Library
The problems which I am facing are as follows:
My R (4.1.0) installation directory does not contain the
src/nmath/standalonedirectory to build the library as mentioned in "6.17 Using these functions in your own C code".I tried building the library by downloading and extracting the
R-4.1.0.tarfile and then following the instructions given here in R-admin. But still getting the error "undefined reference to `dnorm4'" after executing the command as shown below:gcc -g -c -o Interoperate.o Interoperate.c -ID:/R-4.1.0/src/include -LD:/R-4.1.0/src/nmath/standalone/ -lRmath -lm
Interoperate.c contains the following code:
#define MATHLIB_STANDALONE
#include <R.h>
#include <Rmath.h>
int main()
{
/* Inputs */
double V1 = 1;
double V2 = 2;
/* Normal Distribution */
double result = dnorm(V1, V2, M_PI, 1);
printf("%lf\n",result);
return 0;
}
I am out of options now. I need help with this issue.