[R] LoadLibrary failure: : %1 is not a valid Win32 application although arch x64 has been specified

Franckx Laurent laurent.franckx at vito.be
Mon Sep 17 13:10:52 CEST 2012


Problem solved, thank you.

-----Original Message-----
From: Duncan Murdoch [mailto:murdoch.duncan at gmail.com]
Sent: maandag 17 september 2012 13:05
To: Franckx Laurent
Cc: 'r-help at r-project.org'
Subject: Re: [R] LoadLibrary failure: : %1 is not a valid Win32 application although arch x64 has been specified

On 12-09-17 3:56 AM, Franckx Laurent wrote:
> Dear all,
>
> I have problems loading a library in the 64 version of R.
>
> The following happens:
>
>
> *         I have a file, equildistC.cpp, which contains a few lines of C++ code.
>
> *         I have compiled the file using the following commands:
> PATH =
> c:\Rtools\bin;C:\Rtools\gcc-4.6.3\bin;C:\Rtools\gcc-4.6.3\bin64;C:\Rto
> ols\gcc-4.6.3\i686-w64-mingw32;C:\R-2.15.1\bin\i386;C:\R-2.15.1\bin\x6
> 4;c:\windows;c:\windows\system32;C:\Windows\SysWOW64
> R --arch x64 CMD SHLIB equildistC.cpp

That runs the 32 bit version of R (since you list it first in your path).  I don't see any docs that state that it will pay attention to the --arch directive.  (The docs say that syntax is supported under Unix-alikes, not under Windows.)




>
> *         I have received no messages indicating problem during compilation, and both the equildistC.o and the equildistC.dll have been created.
>
> *         When I load the dll in the 32bit version of R with dyn.load("C:\\Ccodefortransortmodel\\equildistC.dll"), things appear to go well.
>
> *         However, in the 64 bit version, I get the message:
> Error in inDL(x, as.logical(local), as.logical(now), ...) :
>    unable to load shared object 'C:/Ccodefortransortmodel/equildistC.dll':
>    LoadLibrary failure:  %1 is not a valid Win32 application.
>
>
> I have googled the error message. Initially I had omitted "--arch x64" when compiling the file, but even after specifying the architecture, the error persists.
> However, I definitely need to be able to run my code on the 64 version.

Then you should take the 32 bit version out of your path.

Duncan Murdoch

>
>
> Kind regards
> Laurent
>
> ________________________________
> [http://www.vito.be/e-maildisclaimer/bsds.png] <http://bsds.vito.be>
> VITO Disclaimer: http://www.vito.be/e-maildisclaimer
>
>       [[alternative HTML version deleted]]
>
>
>
> This body part will be downloaded on demand.
>

________________________________
 [http://www.vito.be/e-maildisclaimer/bsds.png]  <http://bsds.vito.be>

VITO Disclaimer: http://www.vito.be/e-maildisclaimer




More information about the R-help mailing list