<html><body><div style="color:#000; background-color:#fff; font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:10pt"><div><span>I already figured out a great finalizer, I could just use help on one thing.<br>The below finalizer is for the %mat defcfun below that.<br>How do I update the finalizer below to be for the mat-data defcfun at the <br>bottom of the page. So where do I put the rows cols params, there seems <br>to be no place for them in the defstruct wwhere %mat is called. Any<br>help is appreciated
<br> <br> <br> <br>(defstruct (cvmatrix (:constructor %make-cvmatrix))
<br>  (sap (%mat) :type sb-sys:system-area-pointer :read-only t))
<br> <br> (defun make-cvmatrix (&optional enable-finalizer)
<br>  (let* ((matrix (%make-cvmatrix))
<br>          (sap (cvmatrix-sap matrix)))
<br>(when enable-finalizer
<br>    (tg:finalize matrix (lambda () (del-mat sap))))
<br>    sap))
<br><br> <br>(defcfun ("cv_create_Mat" %mat) (:pointer mat)
<br>  "MAT constructor")
<br> <br>;; Mat::Mat(int rows, int cols, int type, void* data) 
<br>;; Mat* cv_create_Mat_with_data(int rows, int cols, int type, void* data)
<br>(defcfun ("cv_create_Mat_with_data" mat-data) (:pointer mat)
<br>  (rows :int)
<br>  (cols :int)
<br>  (type :int)
<br>  (data :pointer))
<br></span></div><div style="display: block;" class="yahoo_quoted"> <div style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 10pt;"> <div style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 12pt;"> <div dir="ltr"> <font face="Arial" size="2"> On Sunday, April 13, 2014 12:28 AM, Willem Rein Oudshoorn <woudshoo@xs4all.nl> wrote:<br> </font> </div> <blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; margin-top: 5px; padding-left: 5px;">  <div class="y_msg_container">Joeish W <<a ymailto="mailto:joeish80829@yahoo.com" href="mailto:joeish80829@yahoo.com">joeish80829@yahoo.com</a>> writes:<br><br>> I have Lisp functions that wrap C wrappers for C++ functions that<br>> contain a new operator. The C wrappers have to stay the same I can't<br>> change those but I was advised to update my method of
 GC.<br><br>As already mentioned before, use the package 'trivial-garbage'.<br><br>The cl-git package that wraps the libgit2 C code might be a good<br>example.  <br><br>The cl-git code tries the handle automatic freeing by the garbage<br>collector, but also allows you to free manually.  <br>In addition it keeps track of dependencies, e.g. in cl-git <br>a 'commit' is only valid as long as the 'repository' is open.<br><br>It is not much code and might give some inspiration.  <br><br>Disclaimer, I was quite involved in this bit of cl-git, the <br>project is on github:<br><br><a href="https://github.com/russell/cl-git" target="_blank">https://github.com/russell/cl-git</a><br><br><br>As an additional question, maybe not well suited for this list.<br>I see you are wrapping the OpenCV code.  There are already two <br>other wrappers.  So I am curious what are the deficiencies of the <br>existing wrappers that your wrapper tries to
 solve?<br><br>Wim Oudshoorn.<br><br><br>_______________________________________________<br>Cffi-devel mailing list<br><a ymailto="mailto:Cffi-devel@common-lisp.net" href="mailto:Cffi-devel@common-lisp.net">Cffi-devel@common-lisp.net</a><br><a href="http://common-lisp.net/cgi-bin/mailman/listinfo/cffi-devel" target="_blank">http://common-lisp.net/cgi-bin/mailman/listinfo/cffi-devel</a><br><br><br></div> </blockquote>  </div> </div>   </div> </div></body></html>