Quincy
Quincy

Reputation: 79

LoadLibrary failure: %1 is not a valid Win32 application. in R

I have a C code which is loaded through R for my project. Using dyn.load, I was able to load the C code in Windows 64 bit machine and Linux server. However, I am getting the following error when I try to load .dll in Windows 32bit machine.

R error while using dyn.load

I tried using the whole path, running the dyn.load command from working directory but none of them worked. My R version: R version

Also, I have edited the system variables and below you can find the system variables.

`C:\ProgramData\Oracle\Java\javapath;
%SystemRoot%\system32;
%SystemRoot%;
%SystemRoot%\System32\Wbem;
%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;
C:\Program Files\Common Files\Roxio Shared\DLLShared\;
C:\Program Files\Common Files\Roxio Shared\10.0\Roxio Central36;
C:\Program Files\Windows Imaging\;
C:\Program Files\QuickTime\QTSystem\;
C:\Program Files\R\R-3.3.2\bin;
C:\Rtools\bin;
C:\Rtools\mingw_32\bin;
C:\Rtools\mingw_32\lib\gcc\i686-w64-mingw32\4.9.3;
C:\Users\******\Documents\R\R-3.3.2\library\Rcpp`

The existing solutions for this type of problem did not help me.

It would be great if someone can help me solve this problem.

Upvotes: 6

Views: 10549

Answers (2)

stevec
stevec

Reputation: 52468

My computer was missing 64 bit java, all I had to do was install it:

  • Go here
  • Click on 'Windows Offline (64-bit)' to download 64 bit java
  • Click on the downloaded file and follow the installation instructions
  • Close RStudio then reopen RStudio
  • Everything worked!

Upvotes: 4

Eduard Malakhov
Eduard Malakhov

Reputation: 1114

Such errors often refer to architecture mismatch, apparently when one tries to load a x86-64 module on a x86 machine. Please, make sure that on the x86 machine you're loading a .dll compiled specifically for the x86 architecture.

Upvotes: 1

Related Questions