For information on using this system, please visit this page.
Created attachment 2139 [details] Patch to put double-quotes around symbol names in tmp.def For example: BASE is a keyword so building a shared object on Windows with a function called BASE fails: code <- ' void BASE(int *nin, double *x) { int n = nin[0]; int i; for (i=0; i<n; i++) x[i] = x[i] * x[i]; } ' writeLines(code,"test_base.c") system("R CMD SHLIB test_base.c") The output is: c:/Rtools/mingw_64/bin/gcc -I"C:/PROGRA~1/R/R-33~1.1/include" -DNDEBUG -I"d:/Compiler/gcc-4.9.3/local330/include" -O2 -Wall -std=gnu99 -mtune=core2 -c test_base.c -o test_base.o c:/Rtools/mingw_64/bin/gcc -shared -s -static-libgcc -o test_base.dll tmp.def test_base.o -Ld:/Compiler/gcc-4.9.3/local330/lib/x64 -Ld:/Compiler/gcc-4.9.3/local330/lib -LC:/PROGRA~1/R/R-33~1.1/bin/x64 -lR C:/Rtools/mingw_64/bin/../lib/gcc/x86_64-w64-mingw32/4.9.3/../../../../x86_64-w64-mingw32/bin/ld.exe: tmp.def:3: syntax error C:/Rtools/mingw_64/bin/../lib/gcc/x86_64-w64-mingw32/4.9.3/../../../../x86_64-w64-mingw32/bin/ld.exe:tmp.def: file format not recognized; treating as linker script C:/Rtools/mingw_64/bin/../lib/gcc/x86_64-w64-mingw32/4.9.3/../../../../x86_64-w64-mingw32/bin/ld.exe:tmp.def:2: syntax error collect2.exe: error: ld returned 1 exit status In my testing, this happens with other ld keywords (LIBRARY, EXPORTS, NAME, SHARED, etc). Putting double-quotes around symbol names under EXPORTS in the tmp.def file created by winshlib.mk appeared to resolve the symbol name / keyword conflict. Attaching a proposed patch for share/make/winshlib.mk and R script with test case. My Windows testing done on: R version 3.3.1 (2016-06-21) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows Server 2008 R2 x64 (build 7601) Service Pack 1 Reference: https://stat.ethz.ch/pipermail/r-devel/2016-August/072973.html
Created attachment 2140 [details] R test code
Thanks. I'll put your patch into R-devel and R-patched.