From: Hoehle, Joerg-C. <Joe...@t-...> - 2005-05-30 11:37:02
|
Hi, Yaroslav Kavenchuk wrote: >> [3]> (ffi:def-c-type t2 (ffi:c-array ffi:character s1)) >S1 is not evaluated. >try >(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. >or >(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. (eval-when (:compile..etc.) (defconstant s2 100)) (macrolet ((my-type (n) `(def-c-type t2 (ffi:c-array ffi:character ,n)))) (my-type s2)) 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. Regards, Jorg Hohle. |