Hello, all

I am building a R package using Fortran source code. The Fortran code is a
subroutine. I can use "R CMD SHLIB  bar.f -o bar.o" to create the shared
library. For the R package, I put the fortran file in the src/ and I use R
code as follows:

".First.lib"<-function(libname,pkgname){library.dynam("barpkg",pkgname,libname)}
barfun<-function(n,x){
  .Fortran("bar",as.integer(n),as.double(x))
}
package.skeleton(name="barpkg",list=c("barfun"))
--------------------------------------------------------------------------
I can build with "R CMD build barpkg", when I check the package with "R CMD
check barpkg", there is an error,

** R
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
*** arch - i386
Error in inDL(x, as.logical(local), as.logical(now), ...) :
  unable to load shared object
'c:/Users/emily/Desktop/rtest/barpkg.Rcheck/barpkg/libs/i386/bar.dll':
  LoadLibrary failure:  %1 is not a valid Win32 application.

Error: loading failed
Execution halted
*** arch - x64
ERROR: loading failed for 'i386'

I don't know how to fix this error. Can anyone help me with this?

Thanks.
-Emily

	[[alternative HTML version deleted]]

