From: Philip Borghesani on 16 Nov 2009 09:39 The best way to do this is with one or more aliases to the function cvGetSeqElem. Generate a MATLAB file using loadlibrary with the mfilename option and edit the file to add aliases for the function with the return types you are going to use. See the bottom of the loadlibrary documentation for an example using mxGetNumberOfDimensions. http://www.mathworks.com/access/helpdesk/help/techdoc/ref/loadlibrary.html Phil "John Lyle" <mathworks(a)myallit.com> wrote in message news:hdlkfp$773$1(a)fred.mathworks.com... >I have a DLL function that returns a char* but I need to cast this to a struct*. Specifically I am trying to use the cvGetSeqElem() >function from OpenCV (http://opencv.willowgarage.com/documentation/dynamic_structures.html#cvGetSeqElem) like this: > > cvRect = calllib('cxcore', 'cvGetSeqElem', cvSeq, 1); > > where cvSeq is of type CvSeqPtr. This returns a string. How do I now cast this to a CvRect* to read the returned values? The > MATLAB signature is: > > [cstring, CvSeqPtr] = cvGetSeqElem(CvSeqPtr, int32)
From: John Lyle on 14 Dec 2009 02:16
Thanks Philip, that's exactly what I was looking for, works perfectly "Philip Borghesani" <philip_borghesani(a)mathworks.spam> wrote in message <hdro7g$2t4$1(a)fred.mathworks.com>... > The best way to do this is with one or more aliases to the function cvGetSeqElem. > > Generate a MATLAB file using loadlibrary with the mfilename option and edit the file to add aliases for the function with the return > types you are going to use. > > See the bottom of the loadlibrary documentation for an example using mxGetNumberOfDimensions. > > http://www.mathworks.com/access/helpdesk/help/techdoc/ref/loadlibrary.html > > Phil > > "John Lyle" <mathworks(a)myallit.com> wrote in message news:hdlkfp$773$1(a)fred.mathworks.com... > >I have a DLL function that returns a char* but I need to cast this to a struct*. Specifically I am trying to use the cvGetSeqElem() > >function from OpenCV (http://opencv.willowgarage.com/documentation/dynamic_structures.html#cvGetSeqElem) like this: > > > > cvRect = calllib('cxcore', 'cvGetSeqElem', cvSeq, 1); > > > > where cvSeq is of type CvSeqPtr. This returns a string. How do I now cast this to a CvRect* to read the returned values? The > > MATLAB signature is: > > > > [cstring, CvSeqPtr] = cvGetSeqElem(CvSeqPtr, int32) > |