如何从python调用带有ref和out参数的C库函数?

2024-09-28 22:24:39 发布

您现在位置:Python中文网/ 问答频道 /正文

我用的是Python而不是铁蟒。在

有这样一个函数:

test(ref string p1,out string p2)

如何在Python3.6中调用test?在

^{pr2}$

Tags: 函数testrefstringoutp2p1pr2
1条回答
网友
1楼 · 发布于 2024-09-28 22:24:39

我不能在没有的情况下测试代码通讯.dll,请检查以下代码是否对您有效:

import clr
import sys
sys.path.append("D:\\dll") # path to dll
clr.AddReference("communication") # add reference to communication.dll
from  communication import test

ref_string_p1 = "     "
out_string_p2 = test(ref_string_p1)
print(out_string_p2)

相关问题 更多 >