如何将类型为'int *'的swig对象转换为ctypes int * [英] How to convert swig object of type 'int *' to ctypes int*

查看:525
本文介绍了如何将类型为'int *'的swig对象转换为ctypes int *的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Python来处理一些数据(int数组)。这是非常缓慢。所以我把处理函数放在一个c ++ DLL中,并通过ctypes与它谈。数据从swig-wrapped模块(c ++)加载。我浏览几乎到处,但发现没有任何东西将类型int *指针的swig对象转换为ctypes int指针。我该如何做?

I was using Python to process some data (int array). It is very slow. So I put the processing function in a c++ DLL and talk with it through ctypes. The data are loaded from swig-wrapped modules (c++). I browsed almost everywhere but found nothing to convert swig object of type 'int *' pointer to ctypes int pointer. How can I do it?

感谢

推荐答案

解决方案这样做后几次尝试。解决这个问题的一个简单方法是使用SWIG封装c ++代码,因此可以将其传递给其他SWIG封装的模块。

It seems no solution to do that after a few attempts. A simple way to fix this problem is wrapping the c++ code with SWIG, so can pass it to other SWIG-wrapped modules.

这篇关于如何将类型为'int *'的swig对象转换为ctypes int *的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆