[Java技术] [求助]请高手帮忙看一下,为啥java调用dll,总是返回false,在a

发信人: wwwyyf (wwwyyf), 信区: Java
标 题: [求助]请高手帮忙看一下,为啥java调用dll,总是返回false,在as
发信站: 水木社区 (Tue Feb 27 17:29:55 2018), 站内

/**
*
*/
package testtest;
import com.sun.jna.Library;
import com.sun.jna.Memory;
import com.sun.jna.Native;
import com.sun.jna.ptr.ByteByReference;

/**
* @author Administrator
*
*
* c#中厂家给出的样例代码中这样引入动态链接库的。
[STAThread]
[DllImport("sms.dll", EntryPoint = "Sms_Connection")]
public static extern uint Sms_Connection(string CopyRight, uint Com_Port, uint Com_BaudRate, out string Mobile_Type, out string CopyRightToCOM);
[DllImport("sms.dll", EntryPoint = "Sms_Disconnection")]
public static extern uint Sms_Disconnection();
[DllImport("sms.dll", EntryPoint = "Sms_Send")]
public static extern uint Sms_Send(string Sms_TelNum, string Sms_Text);
*
*
*/
public class yyf {

public yyf() { // TODO Auto-generated constructor stub

}

public interface JNATestDll extends Library{
JNATestDll instanceDll = (JNATestDll)Native.loadLibrary("sms",JNATestDll.class);
public int Sms_Connection(String CopyRight, int Com_Port,int Com_BaudRate, ByteByReference Mobile_Type, ByteByReference CopyRightToCOM);
public int Sms_Disconnection();
public int Sms_Send(String Sms_TelNum, String Sms_Text);
}
/**
* @param args
*/
public static void main(String[] args) {
//TODO Auto-generated method stub

String CopyRight="//上海迅赛信息技术有限公司,网址www.xunsai.com//";

ByteByReference p_Data1=new ByteByReference();

Memory mymem = new Memory(50);

p_Data1.setPointer(mymem);

ByteByReference p_Data2=new ByteByReference();

Memory mymem1 = new Memory(50);
p_Data2.setPointer(mymem1);
if( JNATestDll.instanceDll.Sms_Connection(CopyRight,1,9600, p_Data1,p_Data2)==1)
{



from 水木社区 电脑技术区十大热门话题 http://ift.tt/2CMRSuc
via IFTTT

评论

此博客中的热门博文

荣耀 20 Pro 也想以外型和拍照取胜

小米全面屏电视 Pro 全系列升级到 4K 面板

[数字家庭] [原创]北京联通IPTV的完美方案