From 3ce8ddfae8335ec2e730b1a184d4aad29038e15d Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Mon, 6 Sep 2021 17:25:26 -0700 Subject: ffi: ffi macro uses load-time. A number of functions take an argument which is a ffi type. Typically, this argument is produced using by a ffi-type-compile call which is produced by the ffi macro. But this ffi-type-compile call is invoked at run time, each time such a function is called. A solution for this is to have the ffi macro hoist the compilation to load time. * stdlib/ffi.tl (ffi): Add load-time wrapping to generated expression. * txr.1: Updated correspondence between (ffi ...) form and equivalent (ffi-type-compile form). --- stdlib/ffi.tl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'stdlib/ffi.tl') diff --git a/stdlib/ffi.tl b/stdlib/ffi.tl index b9a86b7b..7ca45bf1 100644 --- a/stdlib/ffi.tl +++ b/stdlib/ffi.tl @@ -160,7 +160,7 @@ (ffi-elemsize (ffi-type-compile type))) (defmacro ffi (type) - ^(ffi-type-compile ',type)) + ^(load-time (ffi-type-compile ',type))) (define-accessor carray-ref carray-refset) -- cgit v1.2.3