On 21/07/2014 12:10 PM, yiqun yang wrote:> 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.
You will see more information in the files in the barpkg.Rcheck
directory created during the check. You can see some of those messages
on the screen if you do an explicit INSTALL.
I'd guess that the compile failed, but can't guess why.
Duncan Murdoch
>
> 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]]
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel