Martin
Martin

Reputation: 223

Generating 32 Bit dll JNI

Hello im trying to use in a Project a dll generated with JNI.

i generated a 64 Bit dll but my project says %1 is not a valid win32 application

So i decided to generate a new DLL, but this time 32 Bit. I changed the Settings in my Visual Studio like i found i other posts, Configuration to Win32 and Target Machine to MachineX86.

this all works fine but when i try to launch the project with this DLL i get the same error. I checked the DLL with Dependency Walker and found out the DLL is 32Bit, but the included DLL's are 64 Bit.

So you guys are my last hope. Do you have any ideas ?

Notes: i can't change to Linux atm.

Visual Studio 2012 java version "1.7.0_71" Java(TM) SE Runtime Environment (build 1.7.0_71-b14)

Upvotes: 0

Views: 167

Answers (2)

Martin
Martin

Reputation: 223

just read it but i already found my error, the problem was that eclipses changes it's installed JRE's when you switch workspace.

so in my testprogramm where i developed my 64bit libary worked. but not in the real project, where the installed JRE was a different one.

so if anyone has the same problem don't forget to check this

Upvotes: 1

PaulMcKenzie
PaulMcKenzie

Reputation: 35454

Please check your system PATH. Windows will attempt to load the first DLL it finds that matches the DLL's name. Windows doesn't check if the DLL is 32 or 64-bit, it will attempt to load it.

If you built a 32-bit DLL, then you're responsible for making sure that any dependent DLL is also 32-bit, and that Windows finds those 32-bit DLL's first.

Upvotes: 0

Related Questions