<div dir="ltr">I have made some progress on this.  My .sip file now includes:<div><br></div><div><div><font face="monospace, monospace"> 13       void Allocate(int width, int height, int pitch, bool withHost, float *devMem /In/ = NULL, SIP_PYOBJECT hostMem /In/ = NULL);</font></div><div><font face="monospace, monospace"> 14       %MethodCode</font></div><div><font face="monospace, monospace"> 15         Py_BEGIN_ALLOW_THREADS</font></div><div><font face="monospace, monospace"> 16           long length = a0 * a1;</font></div><div><font face="monospace, monospace"> 17           a5 = PyFloat_AsDouble(sipConvertToArray(a5, "f", length, 0));</font></div><div><font face="monospace, monospace"> 18           sipCpp->Allocate(a0, a1, a2, a3, NULL, a5);</font></div><div><font face="monospace, monospace"> 19         Py_END_ALLOW_THREADS</font></div><div><font face="monospace, monospace"> 20       %End</font></div></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">This is, I believe the method that I should be using to grab the arguments, operate on the buffer and then pass the arguments on to the C++ method.</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">As Phil suggested, sipConvertToArray looks like way to go here.  I pass in a memoryview (buffer) using ndarray.data.  Using just sipConvertToArray results in an error saying that no known conversion from Py_OBJECT* to float* is known.</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">Above, I am trying to use PyFloat_AsDouble to make the conversion (that I believe needs to be made).  This though, results in the same error.  I have checked PyQt, PyKDE, PyQwt, and the QGIS project to see if those projects have examples of passing a numpy array in, but must be missing any examples.</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">Any additional suggestions much appreciated for getting numpy array data passed over to the C++ side.</font></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Sep 29, 2016 at 6:58 PM, Jay L. <span dir="ltr"><<a href="mailto:jlaura@asu.edu" target="_blank">jlaura@asu.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Phil, <div><br></div><div>Super helpful and gets me rolling again.  I definitely was not groking many of the annotations so that point is awesome.</div><div><br></div><div>Thanks!</div><span class="HOEnZb"><font color="#888888"><div>J</div></font></span></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Sep 29, 2016 at 5:58 PM, Phil Thompson <span dir="ltr"><<a href="mailto:phil@riverbankcomputing.com" target="_blank">phil@riverbankcomputing.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="m_2304938311942042557HOEnZb"><div class="m_2304938311942042557h5">On 30 Sep 2016, at 1:43 am, Jay L. <<a href="mailto:jlaura@asu.edu" target="_blank">jlaura@asu.edu</a>> wrote:<br>
><br>
> Just starting to dig into SIP. I have a .h file that contains the following public method:<br>
><br>
> void Allocate(int width, int height, int pitch, bool withHost, float *devMem = NULL, float* hostMem = NULL);<br>
><br>
>  have created a corresponding .sip file:<br>
><br>
> 1 //SIP wrapper for CUDA Image<br>
> 2<br>
> 3 class CudaImage<br>
> 4 {<br>
> 5 %TypeHeaderCode<br>
> 6 #include "cudaImage.h"<br>
> 7 %End<br>
> 8<br>
> 9 public:<br>
> 10 CudaImage();<br>
> 11<br>
> 12 void Allocate(int width, int height, int pitch, bool withHost, float *devMem=NULL, float *hostMem=NULL) /KeywordArgs="All"/;<br>
> 13 double Download();<br>
> 14<br>
> 15<br>
> 16 int width;<br>
> 17 int height;<br>
> 18 int pitch;<br>
> 19 };<br>
><br>
> Using CMake, I have the build working, can import the module into Python and can call the constructor (so limited success). I can also call the Allocate method. Unfortunately, on the Python side, I can not get the float *devMem=NULL or float *hostMem=Nullarguments exposed. I have been over the SIP documentation and no Annotations are leaping out as missing.<br>
><br>
> The ultimate goal is to pass a numpy array (.data attribute I believe) to the hostMemargument.<br>
><br>
> How does one go about exposing pointers in SIP? What about pointers with a default, NULL, argument?<br>
<br>
</div></div>Pointers to fundamental types are (by default) treated as a way to return a value from the method and not pass a value to it - see the /In/ annotation.<br>
<br>
You should then hit the problem that you will have to provide hand-written code to handle those arguments because SIP doesn't know how to convert them to a Python object. You probably need to declare the types as SIP_PYOBJECT and handle the conversion in %MethodCode. Alternatively if that is a common situation in your API then consider defined a mapped type.<br>
<br>
If numpy arrays support the buffer protocol then you should look at exploiting that. You should also look at sip.array and sipConvertToArray().<br>
<span class="m_2304938311942042557HOEnZb"><font color="#888888"><br>
Phil</font></span></blockquote></div><br></div>
</div></div></blockquote></div><br></div>