[Mono-list] P/Invoke question

Kelly Leahy kellyleahy@swbell.net
Wed, 16 Mar 2005 16:19:50 -0800 (PST)

Just looking at your code, I can say this looks a
little wierd:

   CvPoint2D32f* crs = null;

You are probably more interested in doing something

   CvPoint2D32f crs;
   cvFindChessBoardCornerGuesses(..., &crs, ...);

since unless you pass a reference to crs, it cannot be
filled by the code.

However, I don't think this is right either.  I think
perhaps your C declaration is either wrong, or the
caller has to preallocate the array of CvPoint2D32f
elements before calling this function.  The reason I
believe this to be true is that in order for the C
function to allocate this block of memory and pass
back the pointer (of type CvPoint2D32f*) it would have
to be passed a value of type CvPoint2D32f** or a
reference variable of type CvPoint2D32f*, neither of
which is done in the declaration you gave here.

int cvFindChessBoardCornerGuesses( 
        const CvArr* image, 
              CvArr* thresh,
       CvMemStorage* storage, 
              CvSize board_size,
       CvPoint2D32f* corners,
                int* corner_count=NULL );

best of luck,