java dll调用 枚举传递

TR_s 2014-10-27 05:06:25
dll 中参数是枚举, java怎么传递枚举参数

现在这是写的java调用dll

1.枚举
public class TPROTOCALTYPE {
public enum tProtocalType {
UART_XDHT, UART_21, UART_30, UART_LKD, UART_40
}
}
2.调用
public class ZHJOpen {
static {
System.loadLibrary("ZhjDll");
System.out.println("success!");
}

public native boolean OpenSerialPort(int nPortNum, TPROTOCALTYPE.tProtocalType t, int b);

public boolean OpenSerialPortT(int uPort, TPROTOCALTYPE.tProtocalType t, int dwB) {
return this.OpenSerialPort(uPort, t, dwB);

}

public static void main(String[] args) {
// TODO Auto-generated method stub

ZHJOpen zhj = new ZHJOpen();
boolean bol = zhj.OpenSerialPortT(4, TPROTOCALTYPE.tProtocalType.UART_40, 115200);
if (bol) {
System.out.println("true");
} else {
System.out.println("false");
}
}
}
出现的错误

Exception in thread "main" java.lang.UnsatisfiedLinkError: ZHJOpen.OpenSerialPort(ILTPROTOCALTYPE$tProtocalType;I)Z
at ZHJOpen.OpenSerialPort(Native Method)
at ZHJOpen.OpenSerialPortT(ZHJOpen.java:10)
at ZHJOpen.main(ZHJOpen.java:21)

没有分数了..但非常感觉大家!
...全文
203 2 打赏 收藏 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
TR_s 2014-10-28
  • 打赏
  • 举报
回复
求大神帮忙啊....
Bywinkey 2014-10-28
  • 打赏
  • 举报
回复
[yabao=http://bbs.csdn.net/bettings][/yabao]

62,620

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧