星空网 > 软件开发 > 操作系统

windows下go调用内存dll

有时候我们希望将dll嵌入到程序内部,以提高程序的安全性,这里我写的一个开源memorydll模块。

首先 go get github.com/nkbai/go-memorydll

然后在需要的时候 import "go-memorydll"即可,

使用起来也非常简单,这里从test例子中摘取.

testdll,_:=base64.StdEncoding.DecodeString(testdllbase64)
dll,err:= memorydll.NewDLL(testdll,"example.dll");
if err!=nil{
t.Error(err)
return
}
proc,err:=dll.FindProc("gcd")
if err!=nil{
t.Error(err)
return
}
result,_,_:=proc.Call(uintptr(4),uintptr(8))
//fmt.Println("rsult=",result)
if int(result)!=4{
t.Error("gcd calc error")
}

 

注意的是,结束的时候记得release相关模块




原标题:windows下go调用内存dll

关键词:Windows

*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: admin#shaoqun.com (#换成@)。

综合型跨境电商:https://www.goluckyvip.com/tag/49748.html
总统日:https://www.goluckyvip.com/tag/49749.html
Listing跟卖:https://www.goluckyvip.com/tag/4975.html
纵横海外仓:https://www.goluckyvip.com/tag/49750.html
纵横跨境电商物流:https://www.goluckyvip.com/tag/49751.html
纵腾谷仓海外仓:https://www.goluckyvip.com/tag/49752.html
武陵山大裂谷周围景点 武陵山大裂谷周围景点图片:https://www.vstour.cn/a/411233.html
南美旅游报价(探索南美洲的旅行费用):https://www.vstour.cn/a/411234.html
相关文章
我的浏览记录
最新相关资讯
海外公司注册 | 跨境电商服务平台 | 深圳旅行社 | 东南亚物流