刚开始深入研究SIP。我有一个包含下面的公共方法.h文件:Python/SIP规范文件 - kwargs和NULL
void Allocate(int width, int height, int pitch, bool withHost, float *devMem = NULL, float* hostMem = NULL);
我创建了一个相应的.sip文件:
1 //SIP wrapper for CUDA Image
2
3 class CudaImage
4 {
5 %TypeHeaderCode
6 #include "cudaImage.h"
7 %End
8
9 public:
10 CudaImage();
11
12 void Allocate(int width, int height, int pitch, bool withHost, float *devMem=NULL, float *hostMem=NULL) /KeywordArgs="All"/;
13 double Download();
14
15
16 int width;
17 int height;
18 int pitch;
19 };
使用cmake,我已经构建工作,可以导入模块进入Python并可以调用构造函数(因此成功有限)。我也可以调用Allocate方法。不幸的是,在Python方面,我无法获得暴露的float *devMem=NULL
或float *hostMem=Null
参数。我已经完成了SIP文档,没有注释失踪。
最终目标是将一个numpy数组(我相信.data属性)传递给hostMem
参数。
如何才能在SIP中暴露指针?什么指针与默认,NULL,参数?
(Python的3.5,PyQt4中,SIP 4.18.x)