*In cl-raylib library (cffi version of raylib game development library) * *there are many constants inside*
*https://github.com/longlene/cl-raylib/blob/master/src/raylib.lisp https://github.com/longlene/cl-raylib/blob/master/src/raylib.lisp* *like* (define-constant +lightgray+ '(200 200 200 255) :test #'equal) (define-constant +gray+ '(130 130 130 255) :test #'equal) ... *I can call those constants in my program like* cl-raylib:+lightgray+ cl-raylib:+gray+ ... *Inside that file there are many things like *
(defcstruct (%vector2 :class vector2-type) "Vector2 type" (x :float) (y :float)) (defstruct vector2 x y) (defmethod translate-from-foreign (pointer (type vector2-type) (with-foreign-slots ((x y) pointer (:struct %vector2)) (make-vector2 :x x :y y))) *In cl-raylib there are functions that take "vector2" type as input for example: *DrawTriangleLines(Vector2 v1, Vector2 v2, Vector2 v3, Color color); *But i can not reach them.* *How can i call them if i can call them directly?, do i need to create them? What must i do? What is the solution? What must i do?*
[I can't handle your html mail so i'm not quoting it]
DrawTriangleLines(Vector2 v1, Vector2 v2, Vector2 v3, Color color);
This passes structs by "value" - it is not passing a pointer but the actual object. This works in arrangement with the C compiler.
To do this in cffi you have to load "cffi-libffi" subsystem first.
This is "documented" in the cffi manual under
- section 6.6 "Foreign Structure Types" - Functions "defcfun" "foreign funcall" - Glossary entry "aggregate type"
I suggest you read up on these and ask again if you have problems.
---
BTW I had submitted a patch to fix some problems with fsbv which was committed on 2020-02-26 but this was reverted in version-0.22.1 on 2020-05-12 - because of some problems with some google library.
I believe the actual fault was in a bug of omission in a commit d315a by Vadim Penzin in on 2014-12-02.
I'd pushed the fix for that for review on my personal branch in https://github.com/enometh/cffi/commit/74a15af823e3bfec7256e9a572c67962ed985...
but Luis doesn't seem to have found the time to check that.
The patch I had submitted (based on the suggestion from luis on this mailing list) fixes other problems I face but subtly changes the sytax for defcvars and my concern is user code may have to change - if it is written before it is fixed.