c12
c12

Reputation: 9827

Loading a dll in Java For Windows XP

I'm attempting to load a dll using the System.loadLibrary("myDllFile") that I built on a linux machine using Makefile. I get a

java.lang.UnsatisfiedLinkError c:\test\myDllFile.dll: can't load this .dll (machine code=0x101) on a IA 32-bit platform

exception when I run the main java class containing the loadLibrary statement. I'm attempting to run the java class on Windows XP. Do I need a separate dll for windows xp (32bit) and windows 7 (64 bit)?

Upvotes: 1

Views: 910

Answers (1)

BRPocock
BRPocock

Reputation: 13914

That's correct. You'll have to port the native code to run on each OS, and link it separately.

However, if you actually have a .dll, and not a .so, it sounds like you may have cross-compiled for Win64, when you meant to do so for Win32. (Perhaps using MinGW?) If you have such a cross-compiler set-up, you should be able to specify building for Win32 vs. Win64. Alternatively, you can tell your 64-bit Linux system to pretend to be 32-bit using setarch i686, if your Makefile happens to be ill-behaving.

If you have a Linux .so, it'll require quite a bit more work to port to Windows…

Upvotes: 1

Related Questions