0

I'm trying to incorporate a collection of Fortran files into R for my research (files are located at http://tyrosine.usc.edu/closure). The files have been compiled into .dll format using MinGW32's GNU Fortran compiler (4.8.1-4). I'm running 32-bit Windows 7, and 32-bit R (3.1.2) via RStudio (0.98.1028).

Since R, Windows, and WinGW32 are 32-bit, this shouldn't be a standard 64-bit vs 32-bit problem, as suggested here:

Not a valid Win32 application

and here:

Using the rJava package on Win7 64 bit with R

The error is:

dyn.load("close1.dll") Error in inDL(x, as.logical(local), as.logical(now), ...) : unable to load shared object 'C:/Users/Morgan/Desktop/close1.dll': LoadLibrary failure: %1 is not a valid Win32 application. nd .

Could it be that the files need to be converted into a package first, given that there are dependencies between them?

Edit: For clarification, I am the one compiling the files into .dll. The files are .tgz compressed.

Community
  • 1
  • 1
Morgan
  • 1
  • 1
  • 2

2 Answers2

0

I recently encountered a similar problem and found that manipulating the method and mode options in download.file solved this problem.

download.file("http://tyrosine.usc.edu/closure/close1.dll",
          paste(c(getwd(),"/close1.dll"), collapse=""),
          method="internal",mode="ab")

dyn.load("close1.dll")

Also, check the downloaded file with Dependency Walker. This revealed that for different mode arguments R altered the file during download to something that was neither a 32-bit or 64-bit application. For me mode="ab" was the only argument that worked.

Best,

Jason

Jason Freels
  • 380
  • 1
  • 11
0

The same I got when loading .dll into R environment by using dyn.load() command. Sol: I have taken the full path of .dll file and the path contains the space(\s) character that is the reason why it displaying the error.After removing the space the command executed successfully. enter image description here

Muhammad Usman
  • 1,366
  • 5
  • 18
  • 33