Hi cih versuche gerade für ein späteres Project zu verstehen wie ich mit JNA auf C++ zugreifen kann.
[c++ code]
[java code]
Exception:
Exception in thread "main" java.lang.UnsatisfiedLinkError: Error looking up function 'Hello': The specified procedure could not be found.
at com.sun.jna.Function.<init>(Function.java:179)
at com.sun.jna.NativeLibrary.getFunction(NativeLibrary.java:344)
at com.sun.jna.NativeLibrary.getFunction(NativeLibrary.java:324)
at com.sun.jna.Library$Handler.invoke(Library.java:203)
at $Proxy0.Hello(Unknown Source)
at BeepExample.main(BeepExample.java:10)
Ich frage mich nun, was ich falsch mache?
Ich benutze MingW mit autoinstaller installiert und eclipse für c/c++ auf einem win xp/32
[c++ code]
Code:
#include <iostream>
using namespace std;
static void Hello(){
cout << "!!!Hello World!!!" << endl; // prints !!!Hello World!!!
}
[java code]
Java:
import com.sun.jna.Library;
import com.sun.jna.Native;
/** Simple example of Windows native library declaration and usage. */
public class BeepExample {
public static void main(String[] args) {
System.load("c:/libHello DLL.dll");
HelloDLL lib = (HelloDLL)Native.loadLibrary("libHello DLL.dll", HelloDLL.class);
lib.Hello();
}
}
interface HelloDLL extends Library {
void Hello();
}
Exception:
Exception in thread "main" java.lang.UnsatisfiedLinkError: Error looking up function 'Hello': The specified procedure could not be found.
at com.sun.jna.Function.<init>(Function.java:179)
at com.sun.jna.NativeLibrary.getFunction(NativeLibrary.java:344)
at com.sun.jna.NativeLibrary.getFunction(NativeLibrary.java:324)
at com.sun.jna.Library$Handler.invoke(Library.java:203)
at $Proxy0.Hello(Unknown Source)
at BeepExample.main(BeepExample.java:10)
Ich frage mich nun, was ich falsch mache?
Ich benutze MingW mit autoinstaller installiert und eclipse für c/c++ auf einem win xp/32