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

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 (#换成@)。

如何登录国际版tiktok:https://www.goluckyvip.com/tag/82612.html
ios用tiktok:https://www.goluckyvip.com/tag/82613.html
ios国际版tiktok:https://www.goluckyvip.com/tag/82614.html
快手国际版tiktok下载:https://www.goluckyvip.com/tag/82616.html
tiktok下载在线:https://www.goluckyvip.com/tag/82617.html
tiktok关注后一会又会消失:https://www.goluckyvip.com/tag/82618.html
零售晚报:携程发布318成绩单 近800万商家GMV增长101% :https://www.kjdsnews.com/a/1836405.html
19点聊电商:百度云:大模型应用元年 企业如何先“卷”一步? :https://www.kjdsnews.com/a/1836406.html
相关文章
我的浏览记录
最新相关资讯
海外公司注册 | 跨境电商服务平台 | 深圳旅行社 | 东南亚物流