Indeed Windows reports misleading error message:
%1 is not a valid Win32 application.
even in cases like loading 64bit dll from a 32bit application or visa versa.
Solaris reports following message in such case:
ld.so.1: load_dll_sol.out: fatal: 64/libjvm_db.so: wrong ELF class: ELFCLASS64
Linux reports even more misleading message! :
./linux64.libjvm.so: cannot open shared object file: No such file or directory
See test applicatins in attachment
So we need to substitute message with a more meaningful like:
"Can't load 64-bit DLL on a 32-bit machine"
But in light of CR 6348631: "remove HPI interface from Hotspot"
we decided to move DLL/so loader to os class. Code for diagnostics requires file open, seek and read operations that I will also implement in os class.