* oleg harput <cadvzwfl1txpgbo9ozkjcwgdbxmkgb3tlwpea7711tykgxh+...@mail.gmail.com> Wrote on Thu, 8 Jun 2023 17:05:29 +0300 > Hi. I want to use the following C function: > > ;; void ClearBackground(Color color); [snip] > (cffi:defcstruct %color > (r :uint8) > (g :uint8) > (b :uint8) > (a :uint8)) > > (defvar *%lightgray* (cffi:foreign-alloc '(:struct %color))) > > ;; void ClearBackground(Color color); > (cffi:defcfun ("ClearBackground" %clear-background) :void > (color (:struct %color))) > > (defun clear-background (color) > (%clear-background color)) > > But when i run > > (clear-background *%lightgray*)
You are passing a pointer to a function which takes a struct by value. you should be trying ``` (clear-background (cffi:mem-ref *%lightgray* '(:struct %color))) ``` > That does not work, I have already added my .asd file ":cffi-libffi" as > dependency. > > What is the problem? If this issue has no solution, is there an alternate > way? Does the proposed form? If it does not, please follow up. ---