[cffi-devel] getting There is no applicable method for the generic function wrapping cvFont

Joeish W joeish80829 at yahoo.com
Sat Oct 26 04:10:18 UTC 2013



I wrapped this function how i normally do which is usually correct


the function im wrapping is here...info at least and a small example of its usage is there also at the end of the postl


;; CvFont cvFontQt(const char* nameFont, int pointSize = -1, CvScalar color = cvScalarAll(0), int weight = CV_FONT_NORMAL, 
;; int style = CV_STYLE_NORMAL, int spacing = 0) 
(cffi:defcfun ("cvFontQt" %font-qt) (:struct cv-font) 
 
 (name-font :string)
  (point-size :int) 
  (color (:struct cv-scalar))
  (weight :int) 
  (style :int)
  (spacing :int))
 
(defun font-qt (name-font &optional (point-size -1) (color (scalar-all 0)) (weight +font-normal+) 
                   (style +style-normal+) (spacing 0)) 
  "Creates the font to draw a text on an image." 
             (%font-qt name-font point-size color weight style spacing)) 



im getting this error message when i run each of these

 (with-foreign-object (font '(:struct cv-font))
          (setf (mem-ref font `(:pointer (:struct cv-font))) (font-qt "Monospace")))

(defparameter  font (foreign-alloc '(:struct cv-font) :initial-element (list (font-qt ""))))

 (font-qt "")


There is no applicable method for the generic function
  #<STANDARD-GENERIC-FUNCTION TRANSLATE-INTO-FOREIGN-MEMORY (5)>
when called with arguments
  ("" #<CFFI::FOREIGN-STRING-TYPE :UTF-8>
   #.(SB-SYS:INT-SAP #X7FFFE1467FF0)).
   [Condition of type SIMPLE-ERROR]

it seems to be written right and I'm just running the function so i could use a little help on this . I never use any of cffi foreign-string functions for const char* just :string and they always run right
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/cffi-devel/attachments/20131025/d8497d1f/attachment.html>


More information about the cffi-devel mailing list