title: Can I wrap OpenCV's C++ interface with C and then wrap that with Lisp's CFFI?
body: <p>I was also wondering about the possibility of wrapping OpenCV's C++ interface in C and then wrapping that in Lisp so I could add all the C++ functionality as well to my cl-opencv wrapper because I would like to make it complete.... Also wondered if I do that, can I use the C++ wrapper with the C wrapper in lisp ....if it is possible if you could show me a quick example program,  like an open window and show a picture function, only in c and c++ together ....like using cv::namedWindow instead of cvNamedWindow and all the other parts being c .....here is my attempt the program below runs when i use cv::namedWindow only but fails with</p>
  
  <pre><code> shape.cpp:37:32: error: invalid initialization of 
   reference of type ‘cv::InputArray {aka const cv::_InputArray&amp;}’
    from expression of type ‘IplImage* {aka _IplImage*}’In file included from 
   /usr/local/include/opencv/highgui.h:48:0,
  
                     from shape.cpp:4:
   /usr/local/include/opencv2/highgui/highgui.hpp:78:19: error: 
   in passing argument 2 of ‘void cv::imshow(const string&amp;, cv::InputArray)’
   Compilation exited abnormally with code 1 at Thu Sep 26 21:18:00
  </code></pre>
  
  <p>when i add cv::imshow</p>
  
  <pre><code>  #include &lt;cv.h&gt;
    #include &lt;highgui.h&gt;
    using namespace std;
  
  
    int main(){
          CvCapture* capture =0;       
  
          capture = cvCaptureFromCAM(0);
          if(!capture){
    printf("Capture failure\n");
    return -1;
          }
  
          IplImage* frame=0;
  
  
          cv::namedWindow("Video");
  
  
  
     // cout &lt;&lt; "colorModel = " &lt;&lt; endl &lt;&lt; " " &lt;&lt; size &lt;&lt; endl &lt;&lt; endl;
  
  
     while(true){
  
                frame = cvQueryFrame(capture);           
                if(!frame) break;
  
                frame=cvCloneImage(frame);
  
  
  
  
            cv::imshow("Video", frame );
  
  
                cvReleaseImage(&amp;frame);
  
                //Wait 50mS
                int c = cvWaitKey(10);
                //If 'ESC' is pressed, break the loop
                if((char)c==27 ) break;      
          }
  
          cvDestroyAllWindows() ;
          cvReleaseCapture(&amp;capture);     
  
          return 0;
    }
  </code></pre>
  
  <p>I'd like to know if it would be doable...like be 100% sure before i start,  that i could at least wrap every c++ function in c and wrap that with lisp..or if u think id run into snags in some places or even impossibilities.....and also would wrapping it twice make it slow? and id the c interface better/worse than the c++..or can i accomlish everything in the c interface  that i can in c++</p>
  
  <p>i ask this because in the swig and cffi documentation it says the c++ support is not complete.</p>
  
  <p>oh yeah and i also tried running the above code with all these headers</p>
  
  <pre><code>#include &lt;cv.h&gt;
  #include &lt;highgui.h&gt;
  #include "opencv2/highgui/highgui.hpp"
  #include &lt;iostream&gt;
  
  using namespace cv;
  using namespace std;
  </code></pre>
  
  <p>and still get above error</p>