第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

java使用jna調(diào)用

java使用jna調(diào)用

楊__羊羊 2018-08-30 18:29:41
現(xiàn)在有一個獲取機器碼的c++開發(fā)好的dll,java程序需要調(diào)用這個dll獲取到機器碼;1)、dll里面有個int getMacCode(char *p)這個函數(shù);2)、讓p這個指針指向的地址空間保存了機器碼;3)、用java如何實現(xiàn)這個調(diào)用過程?ps:目前用jna來調(diào)用,但是一直報找不到函數(shù)的錯誤,“java.lang.UnsatisfiedLinkError: Error looking up function 'getMacCode':xxxx”;估計認為是參數(shù)傳遞上錯誤了,請大神賜教
查看完整描述

2 回答

?
德瑪西亞99

TA貢獻1770條經(jīng)驗 獲得超3個贊

再看了下問題,貌似不是這個原因??赡苄枰闾c代碼出來才曉得了
下面的東西先留著,等找到真正的原因了再來改吧


看樣子是 DLL 沒加載到,JNA 的文檔里有設(shè)置路徑的辦法

Make your target library available to your Java program. There are several ways to do this:

  • The preferred method is to set the jna.library.path system property to the path to your target library. This property is similar to java.library.path, but only applies to libraries loaded by JNA.

  • Change the appropriate library access environment variable before launching the VM. This is PATH on Windows, LD_LIBRARY_PATH on Linux, and DYLD_LIBRARY_PATH on OSX.

  • Make your native library available on your classpath, under the path {OS}-{ARCH}/{LIBRARY}, where {OS}-{ARCH} is JNA's canonical prefix for native libraries (e.g. win32-x86, linux-amd64, or darwin). If the resource is within a jar file it will be automatically extracted when loaded.

大概就是需要你把 DLL 所在目錄設(shè)置在系統(tǒng)的 PATH 路徑里,或者通過 java 的參數(shù) jna.library.path 指定目錄,

java -Djna.library.path=PATH_TO_YOUR_DLL ClassName


查看完整回答
反對 回復(fù) 2018-09-16
?
犯罪嫌疑人X

TA貢獻2080條經(jīng)驗 獲得超4個贊

參數(shù)應(yīng)該是byte[]類型的

查看完整回答
反對 回復(fù) 2018-09-16
  • 2 回答
  • 0 關(guān)注
  • 759 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號