[JNA] erreur d'exécution UnsatisfiedLinkError
j'ai essayer de mettre en œuvre un exemple simple de JNA telsque
le code C++:
Code:
1 2 3
| extern __declspec(dllexport) int test (int i){
return i;
} |
le code Java:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| import com.sun.jna.Native;
import com.sun.jna.win32.StdCallLibrary;
/** Simple example of native library declaration and usage. */
public class CTT {
//static {System.loadLibrary("libdllTest"); }
public interface CttInterface extends StdCallLibrary {
// Method declarations, constant and structure definitions go here
CttInterface lib = (CttInterface) Native.loadLibrary("libdllTest", CttInterface.class);
int test(int i);
}
public static void main(String[] args) {
System.out.println(CttInterface.lib.test(1));
}
} |
j'ai pu générer le fichier dll mais le code java possède erreur d'exécution:
Code:
Exception in thread "main" java.lang.UnsatisfiedLinkError: Error looking up function 'test': La procédure spécifiée est introuvable.
j'ai pas pu comprendre ce problème, y-a-t il une solution!