python - 调用一个应该通过 ctype 返回 None 的函数,它返回整数
问题描述
我正在编写一个 ctypes 代码来从 DLL 调用函数。其中一项功能是传感器的连接功能。此函数应将处理程序返回给传感器(void*),但如果失败,则应返回 Null。
该函数采用 IP 和端口连接到传感器。问题是它不断返回整数 like(45940800),每次执行都会改变。无论输入 IP 或端口如何,始终返回整数。这个整数是多少?是处理程序还是指向轮廓传感器的指针?为什么当我完全没有连接到传感器时功能没有显示 NULL 指针?
from ctypes import*
lib=windll.LoadLibrary("c:\\weCat3D\\weCat3D\\EthernetScanner\\EthernetScanner")
EthernetScanner_Connect = lib.EthernetScanner_Connect
EthernetScanner_Connect.restype=c_void_p
EthernetScanner_Connect.argtypes =[c_char_p,c_char_p,c_int]
x=EthernetScanner_Connect(b'192.168.100.1',b'32001\0',0)
print(x)
The function takes an IP and Port to connect to a sensor. The problem is that it keeps returning integer like(45940800) which change every time i run. Whatever the input IP or Port the integer is always returned. What is this integer? is it the handler or the pointer to profile sensor? why is the function not showing the NULL pointer while i am totally not connected to the sensor?
解决方案
推荐阅读
- python - 为什么chain.from_iterable 不遍历int 列表?
- android - 通过 LAN Wi-Fi 网络从麦克风流式传输音频
- r - 如何调整轴的比例(或间隔)?
- javascript - 如何在 Javascript 中使用 1 位二进制数组
- security - 使用相同的密钥加密多个缓冲区
- python - Python,乌龟不会出现,也不会响应键盘控制
- java - 如何在 ListView 中逐个下载文件?
- css - 当我将它浮动到左侧时,为什么我的 div 左侧有这么多空白空间?
- javascript - lodash cloneDeep 从对象中删除代理
- javascript - 如何操作生成的 CSS