栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

CTYPES:过程可能调用了太多参数(超出了92个字节)

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

CTYPES:过程可能调用了太多参数(超出了92个字节)

如果使用的是 windll.LoadLibrary ,请尝试改用 CDLL

来自网络:“该函数的调用约定是x86 cdecl,但是您使用的是x86 stdcall约定(WinDLL)。”
如果您使用的是32位Python,则可能是约定俗成的问题。

对于这样的C函数:

__declspec(dllexport) int __cdecl wrp_testchar(int steps, double in_data[], char* in_char )

python代码必须是:

N = 2from ctypes import *# Load the library hllDll = CDLL("testchar.dll") wrp_testchar = hllDll.wrp_testchar # Specify the parameter and return types hllDll.wrp_testchar.argtypes = [POINTER(c_int), POINTER(c_double * N), c_char_p]# Next, set the return types... hllDll.wrp_testchar.restype = c_intsteps = (c_int)(2)in_data = (c_double * N)() in_data[0] = float(1) in_data[1] = float(1)in_char = (c_char_p)(b'Helloworld')a = int(0)# Call function a = wrp_testchar(byref(steps), byref(in_data), in_char)


转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/611467.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号