[R] compiling C files with Makefile for R under Windows

MARIA LOURDES MOLERA PERIS lmolera at um.es
Fri Jul 10 10:28:19 CEST 2009


I’ve compiled a .c file for R under Windows using Rtools (R CMD SHLIB 
filename.c) without any big problems, obtaining an .o file and a .dll 
file (I think it is only the last one that I need for R Windows). But 
now I need to compile another .c file prepared for R under Unix with a 
Makefile and I don’t know how to do this. Does R CMD admit this file? If 
so, how should I do it? The program I want to compile uses the gsl 
library, so its Makefile has the following sentences:
all: zeta_func.o
gcc -L/sw/lib zeta_func.o -lgsl -lgslcblas -lm -o zeta_func
zeta_func.o:
gcc -I/sw/include -c zeta_func.c

I suppose I should make changes in the Makefile to adapt it to my 
configuration (where I have the gsl library) but I’m not sure the 
following adaptation is correct:
all: zeta_func.dll
gcc C:\R\library zeta_func.dll -lgsl -lgslcblas -lm -o zeta_func
zeta_func.dll:
gcc C:\R\include -c zeta_func.c

Thank you.




More information about the R-help mailing list