如何在Python中使用C中的float **?
在我的问题 How to use float ** in Python 没有成功之后与 Swig?,我开始认为 Swig 可能不是首选武器。我需要一些 c 函数的绑定。这些函数之一需要一个浮点数**。你会推荐什么? C型?
接口文件:
extern int read_data(const char *file,int *n_,int *m_,float **data_,int **classes_);
after having no success with my question on How to use float ** in Python with Swig?, I started thinking that swig might not be the weapon of choice. I need bindings for some c functions. One of these functions takes a float**. What would you recomend? Ctypes?
Interface file:
extern int read_data(const char *file,int *n_,int *m_,float **data_,int **classes_);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我现在已经在几个项目中使用了 ctypes,并且对结果非常满意。我认为我个人还不需要指针到指针包装器,但理论上,您应该能够执行以下操作:
I've used
ctypes
for several projects now and have been quite happy with the results. I don't think I've personally needed a pointer-to-pointer wrapper yet but, in theory, you should be able to do the following: