autoit - AutoIt - DllCall - 我的 dll 调用不返回值
问题描述
我使用 - C#、vb.net 和 FreeBasic 创建了自己的 dll - 功能是添加 2 个。返回值为空白(使用 FreeBasic 时)或 0(对于 c# 和 vb.net)。
有人可以在这件事上帮助我吗?
AutoIt 代码很简单,如下所示:
#include <MsgBoxConstants.au3>
;Local $hDLL = DllOpen(@ScriptDir & "\clsAddMul.dll") ; vb.net & c#
Local $hDLL = DllOpen(@ScriptDir & "\Math1.dll") ;FreeBasic
Local $aResult = 555
$aResult = DllCall($hDLL, "Int", "_add", "Int", 7, "Int", 8)
;$aResult = DllCall($hDLL, "int", "_add", "int", 7, "int", 8)
DllClose($hDLL)
MsgBox (0, "Result", "Total = " & $aResult)
功能代码如下:
1 - FreeBasic 代码:
Extern "Windows-MS"
Function _add(no1 As Integer, no2 As Integer) As Integer Export
Dim result As Integer
result = no1 + no2
' result = 10
' Return no1+no2
Return result
End Function
End Extern
同样,vb.net 和 c# 也没有 Extern 和 Export 等。这里没有包括它,因为它的例子非常简单。
解决方案
推荐阅读
- xml - 使用 xmlstarlet 搜索 XPATH 并更新父元素
- selenium - 为什么所有测试用例都没有被报告给 xray
- azure-devops - 如何限制管道触发
- electron - 来自 loadURL 的电子桌面捕获器
- ruby-on-rails - Rails ActionController::ParameterMissing(参数丢失或值为空
- javascript - 无法弄清楚使值相加的逻辑
- c++ - 如何计算QString qt c ++中'\ n'的数量
- python - 混淆矩阵无法显示所有标签
- raspberry-pi - 添加 -t 4:float 选项时出现 MBPOLL 错误
- javascript - 如何确定在图表js上单击了哪个栏