0
我正在嘗試編寫一個自定義的linux庫(*。so),並且我已經在基礎知識上做了很多工作。 我想通過JNA使用這個庫。問題是,當Eclipse正在試圖運行的方法Test()
出現此錯誤消息Exception in thread "main" java.lang.UnsatisfiedLinkError: Error looking up function 'Test': /path/to/libexports.so undefined symbol: Test
線程「main」中的異常java.lang.UnsatisfiedLinkError:undefined symbol:Test
這裏的lib代碼:
#ifdef EXPORTS
#define NATIVE_API __declspec(dllexport)
#else
#define NATIVE_API __declspec(dllimport)
#endif
extern "C" {
NATIVE_API int __stdcall Test(){
cout << "hello!";
}
}
這是Java代碼:
public interface IJnaTest extends StdCallLibrary{
IJnaTest instance = (IJnaTest) Native.loadLibrary("exports", IJnaTest.class);
public int Test();
}
的在主要呼叫:
IJnaTest.instance.Test()
有人可以告訴我爲什麼這不起作用?
關注Wurmi