trivial Garbage finalizer and parameters for the constructor

Discussion of Common Lisp

trivial Garbage finalizer and parameters for the constructor

Postby joeish80829 » Sun Apr 13, 2014 7:19 am

I already figured out a great finalizer, I could just use help on one thing.
The below finalizer is for the %mat defcfun below that.
How do I update the finalizer below to be for the mat-data defcfun at the
bottom of the page. So where do I put the rows cols params, there seems
to be no place for them in the defstruct wwhere %mat is called. Any
help is appreciated

Code: Select all
 
 
(defstruct (cvmatrix (:constructor %make-cvmatrix))
  (sap (%mat) :type sb-sys:system-area-pointer :read-only t))
 
 (defun make-cvmatrix (&optional enable-finalizer)
  (let* ((matrix (%make-cvmatrix))
          (sap (cvmatrix-sap matrix)))
(when enable-finalizer
    (tg:finalize matrix (lambda () (del-mat sap))))
    sap))

 
(defcfun ("cv_create_Mat" %mat) (:pointer mat)
  "MAT constructor")
 
;; Mat::Mat(int rows, int cols, int type, void* data)
;; Mat* cv_create_Mat_with_data(int rows, int cols, int type, void* data)
(defcfun ("cv_create_Mat_with_data" mat-data) (:pointer mat)
  (rows :int)
  (cols :int)
  (type :int)
  (data :pointer))
joeish80829
 
Posts: 153
Joined: Tue Sep 03, 2013 5:32 am

Return to Common Lisp

Who is online

Users browsing this forum: No registered users and 41 guests

cron