SIPを掘り始めたところです。次のパブリック メソッドを含む .h ファイルがあります。
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)