1 message in net.java.dev.jna.usersVery odd JNA behaviour.
FromSent OnAttachments
Mikel Cármenes CaviaJun 4, 2008 11:01 am 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Very odd JNA behaviour.Actions...
From:Mikel Cármenes Cavia (mik@greenimaging.com)
Date:Jun 4, 2008 11:01:29 am
List:net.java.dev.jna.users

Hey guys,

I am writing in to the list as my last resort, after having spent a good few hours trying to figure out what the issue is.

Basically, I am making use of JNA to link a Java application to a DLL file, which contains a mathematical algorithm to compute stuff. GIven that I was unable to talk to it directly (issues with entry points and whatnot), I proceeded to create a C file, which I subsequently compiled into a DLL that wraps around the original DLL. This process works like a charm in my development machine: I added the JNA.jar file, set the jna.library.path property accordingly, and I was readily able to access the method in the wrapper DLL, through the following interface:

public interface CurviLibrary extends Library { CurviLibrary CurviInitialization = (CurviLibrary) Native.loadLibrary("Curvi",CurviLibrary.class); CurviLibrary OptimizedSolver = (CurviLibrary) Native.loadLibrary("OptimizedSolver",CurviLibrary.class); DoubleByReference GIT_CURVIG(float[] timeData, float[] rawData, float[] relax, int rawDataSize, double alphaValue, long numberOfBins); }

Everything was nice and good, until I committed all of my code and tried to execute the same functionality in a different machine.

It turns out that the exact same IDE, running the exact same version of the code, with all the jar's and dll's in place, cannot function correctly with JNA and the wrapper DLL. I've even gone as far as creating a simple dll containing a mere cout statement, and that won't even work in this other machine. So essentially, not only will it not work for the whole functionality, but it doesn't even seem to work for simple stuff like loading a dll and executing a single void method.

So, in a nutshell, I'm not exactly sure as to what I need help with. I used Visual C++ 2008 Express Edition to create the DLL's (except for the original DLL that I wrap around, which I was given).

Any clues as to where to tackle this problem?

Thanks so much in advance, I look forward to reading everyone's responses.

Cheers,

Mikel