recently I used gcc 4.9.1 (http://sourceforge.net/projects/mingw-w64/files/Toolchains targetting Win64/Personal Builds/mingw-builds/)on windows to build R,but failed when link R.dll ,it report linker status 5. 
after some digging, I found when use gcc 4.9.1 64 bit on windows there are lots of .refptr.*(* is r function name) in R.def, which lead build fail.so I add a simple path to src/gnuwin32/Makefile:

Index: Makefile
===================================================================
--- Makefile(版本 66200)
+++ Makefile(工作副本)
@@ -148,7 +148,7 @@
 ifeq "$(WIN)" "64"
 R.dll: $(OBJS) $(OBJS-EXTRA) $(MAINLIBS) $(EXTRALIBS) dllversion.o
 @$(ECHO) EXPORTS > R.def
-@$(NM) $^ | $(SED) -n  $(SYMPAT) | LC_COLLATE=C $(SORT) | uniq > R0.def
+@$(NM) $^ | $(SED) -n  $(SYMPAT) | LC_COLLATE=C $(SORT) | uniq |$(SED) '/.refptr./d' > R0.def
 @$(SED) -e's/@.*//' Rdll.hide | LC_COLLATE=C $(SORT) > R1.def
 @LC_COLLATE=C comm -23 R0.def R1.def >> R.def
 $(DLL) -shared $(DLLFLAGS) $($*-DLLFLAGS) -o $@ R.def $^ $($*-DLLLIBS) $(DLLLIBS)
@@ -156,7 +156,7 @@
 else
 R.dll: $(OBJS) $(OBJS-EXTRA) $(MAINLIBS) $(EXTRALIBS) dllversion.o
 @$(ECHO) EXPORTS > R.def
-@$(NM) $^ | $(SED) -n  $(SYMPAT) | LC_COLLATE=C $(SORT) | uniq > R0.def
+@$(NM) $^ | $(SED) -n  $(SYMPAT) | LC_COLLATE=C $(SORT) | uniq |$(SED) '/.refptr./d' > R0.def
 @LC_COLLATE=C $(SORT) Rdll.hide > R1.def
 @LC_COLLATE=C comm -23 R0.def R1.def >> R.def
 $(DLL) -shared $(DLLFLAGS) $($*-DLLFLAGS) -o $@ R.def $^ $($*-DLLLIBS) $(DLLLIBS)


Yu Gong
2014/07/18
	[[alternative HTML version deleted]]

