<html><body><div style="color:#000; background-color:#fff; font-family:bookman old style, new york, times, serif;font-size:14pt"><div style="" class=""> I have a define-foreign-type, translate-to-foreign, translate-from-foreign and a defclass at bottom of this page<a style="" class="" href="https://gist.github.com/"></a></div><div style="" class=""><br style="" class=""></div><div style="color: rgb(0, 0, 0); font-size: 18.6667px; font-family: bookman old style,new york,times,serif; background-color: transparent; font-style: normal;" class="">  These four sections of code make up my types. At the top of the code is a defcstruct that, I am trying to make a part of my types  by changing the :actual-type in the define-foreign-type to:   <br style="" class=""></div><div style="color: rgb(0, 0, 0); font-size: 18.6667px; font-family: bookman old style,new york,times,serif; background-color: transparent; font-style: normal;" class=""><br
 style="" class=""></div><div style="color: rgb(0, 0, 0); font-size: 18.6667px; font-family: bookman old style,new york,times,serif; background-color: transparent; font-style: normal;" class="">   (:actual-type '(:pointer (:struct rect1))).<br style="" class=""></div><div style="color: rgb(0, 0, 0); font-size: 18.6667px; font-family: bookman old style,new york,times,serif; background-color: transparent; font-style: normal;" class=""><br style="" class=""></div><div style="color: rgb(0, 0, 0); font-size: 18.6667px; font-family: bookman old style,new york,times,serif; background-color: transparent; font-style: normal;" class="">The :actual-type is normally :pointer and that makes it so the defcfun at the bottom of code section compiles no problem.  When I compile the code here I get an error in my defcun saying that "(:pointer (:struct rect1)) is not a cffi type".  Why is it doing this and how can I make the actual type of my
 define-foreign-type a (:pointer (:struct rect1))?  The reason I would like to do this is so I can convert the C data to lisp data as soon as possible. If this won't work and you have any other suggestions on how to do this professionally. pls let me know. Thank you.<br></div><div style="color: rgb(0, 0, 0); font-size: 18.6667px; font-family: bookman old style,new york,times,serif; background-color: transparent; font-style: normal;" class=""><br style="" class=""></div><div style="color: rgb(0, 0, 0); font-size: 18.6667px; font-family: bookman old style,new york,times,serif; background-color: transparent; font-style: normal;" class=""><br style="" class=""></div><div style="color: rgb(0, 0, 0); font-size: 18.6667px; font-family: bookman old style,new york,times,serif; background-color: transparent; font-style: normal;" class="">;;;;Code</div><div style="color: rgb(0, 0, 0); font-size: 18.6667px; font-family: bookman old style,new york,times,serif;
 background-color: transparent; font-style: normal;" class=""><br style="" class=""></div><pre style="" class=""><div style="" class="" id="file-gistfile1-txt-LC2">(cffi:defcstruct rect1</div><div style="" class="" id="file-gistfile1-txt-LC3">   (x :int)</div><div style="" class="" id="file-gistfile1-txt-LC4">        (y :int)</div><div style="" class="" id="file-gistfile1-txt-LC5">  (width :int)</div><div style="" class="" id="file-gistfile1-txt-LC6"> (height :int))</div><div style="" class="" id="file-gistfile1-txt-LC7"> </div><div style="" class="" id="file-gistfile1-txt-LC8"> </div><div style="" class="" id="file-gistfile1-txt-LC9">(define-foreign-type rect ()</div><div style="" class="" id="file-gistfile1-txt-LC10">  ((garbage-collect  :reader garbage-collect :initform nil :initarg </div><div style="" class="" id="file-gistfile1-txt-LC11">                     :garbage-collect))</div><div style="" class="" id="file-gistfile1-txt-LC12"> 
 (:actual-type '(:pointer (:struct rect1)))</div><div style="" class="" id="file-gistfile1-txt-LC13">  (:simple-parser rect))</div><div style="" class="" id="file-gistfile1-txt-LC14"> </div><div style="" class="" id="file-gistfile1-txt-LC15"> </div><div style="" class="" id="file-gistfile1-txt-LC16">(defclass cv-rect ()</div><div style="" class="" id="file-gistfile1-txt-LC17">  ((c-pointer :reader c-pointer :initarg :c-pointer)))</div><div style="" class="" id="file-gistfile1-txt-LC18"> </div><div style="" class="" id="file-gistfile1-txt-LC19"> </div><div style="" class="" id="file-gistfile1-txt-LC20">(defmethod translate-to-foreign ((lisp-value cv-rect) (c-type rect))</div><div style="" class="" id="file-gistfile1-txt-LC21">  (values  (c-pointer lisp-value) lisp-value))</div><div style="" class="" id="file-gistfile1-txt-LC22"> </div><div style="" class="" id="file-gistfile1-txt-LC23"> </div><div style="" class=""
 id="file-gistfile1-txt-LC24">(defmethod translate-from-foreign (c-pointer (c-type rect))</div><div style="" class="" id="file-gistfile1-txt-LC25">  (let ((rectangle  (make-instance 'cv-rect :c-pointer c-pointer)))</div><div style="" class="" id="file-gistfile1-txt-LC26">    (when (garbage-collect c-type)</div><div style="" class="" id="file-gistfile1-txt-LC27">      (tg:finalize rectangle (lambda () (del-rect c-pointer))))</div><div style="" class="" id="file-gistfile1-txt-LC28">    rectangle))</div><div style="" class="" id="file-gistfile1-txt-LC29"> </div><div style="" class="" id="file-gistfile1-txt-LC30"> </div><div style="" class="" id="file-gistfile1-txt-LC31"> </div><div style="" class="" id="file-gistfile1-txt-LC32">(defcfun ("cv_create_Rect4" rect-4) rect</div><div style="" class="" id="file-gistfile1-txt-LC33">  "RECT constructor."</div><div style="" class="" id="file-gistfile1-txt-LC34">  (x :int)</div><div style="" class=""
 id="file-gistfile1-txt-LC35">  (y :int)</div><div style="" class="" id="file-gistfile1-txt-LC36">  (width :int)</div><div style="" class="" id="file-gistfile1-txt-LC37">  (height :int))</div></pre><div style="" class=""><br style="" class=""></div></div></body></html>