Yaroslav Kavenchuk wrote:
>> > (ffi:def-c-type t2 (ffi:c-array ffi:character s1))
>S1 is not evaluated.
>(eval `(ffi:def-c-type t2 (ffi:c-array ffi:character ,s1)))
That will probably not work with other forms using this type in compiled mode.
>(ffi:def-c-type t2 (ffi:c-array ffi:character #.s1))
I generally dislike use of #. but that's just a personal bias.
Use macros when you need an extra round of evaluation.
(defconstant s2 100))
(macrolet ((my-type (n) `(def-c-type t2 (ffi:c-array ffi:character ,n))))
While this looks like overkill or convoluted, it has none of the above drawbacks; it is fully compatible with compilation, doesn't give a hit on the EVAL/EVIL counter and is as top-level as the original (def-c-type ...) form.
Get latest updates about Open Source Projects, Conferences and News.