[R] Problem building a DLL from Fortran 90 source under Windows (with solution)

Mstislav Elagin elagin at wias-berlin.de
Mon Oct 9 09:32:41 CEST 2006


Hi, All,

I have come across a problem building a DLL from .f90 source (R 2.3.1, 
Windows XP). When using the R CMD SHLIB procedure, the DLL itself was 
being built, but its export table was empty.

Among the output from R CMD SHLIB the following message appeared:

c:\mingw\bin\nm.exe: 'a.out': No such file

The reason is the empty list of dependencies in the pattern rule for 
DLLs contained in the file MkRules:

%.dll:
	@$(ECHO) EXPORTS > $*.def
	@$(NM) $^ | $(SED) -n 's/^........ [BCDRT] _/ /p' >> $*.def

The dependencies list is constructed in the MakeDll file that contains
the following:

CFSOURCES=$(wildcard -f *.c *.f *.f90 *.f95)
CSOURCES=$(wildcard -f *.c)
CXXSOURCES=$(wildcard -f *.cc *.cpp *.C)
FSOURCES=$(wildcard -f *.f)
FCSOURCES=$(wildcard -f *.f90 *.f95)
OBJSA=$(foreach i,$(CSOURCES) $(FSOURCES) $(CXXSOURCES),$(basename $i).o)

Observe that the neither CFSOURCES nor FCSOURCES in included in OBJSA,
i.e. an object file made from a f90 source never becomes part of
dependencies. If I add $(FCSOURCES) to OBJSA, the DLL gets built
correctly.

I wonder whether there is a reason for not including .f90 (and .f95)
sources in the list of dependencies or this can be considered a bug in
R.

WBR
-- 
Mstislav Elagin



More information about the R-help mailing list