From bb3f48af4edf31d9d27c1e5263edbcdeac28b675 Mon Sep 17 00:00:00 2001 From: Dmitry Solomennikov Date: Thu, 14 Aug 2025 15:31:13 +0300 Subject: [PATCH] Allow usage of (ffi:def-foreign-type ... ) Signed-off-by: Dmitry Solomennikov --- src/cmp/cmpbackend-cxx/cmpc-mach.lsp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/cmp/cmpbackend-cxx/cmpc-mach.lsp b/src/cmp/cmpbackend-cxx/cmpc-mach.lsp index ad4794e15..0e0dae153 100644 --- a/src/cmp/cmpbackend-cxx/cmpc-mach.lsp +++ b/src/cmp/cmpbackend-cxx/cmpc-mach.lsp @@ -38,12 +38,20 @@ (defun host-type-record (host-type) (ext:if-let ((record (gethash host-type (machine-host-type-hash *machine*)))) record - (cmperr "Not a valid C type name ~A" host-type))) + (if ffi::*ffi-types* + (let ((ffi-type (gethash host-type ffi::*ffi-types*))) + (if ffi-type + (host-type-record ffi-type) + (cmperr "Not a valid FFI type name ~A" host-type))) + (cmperr "Not a valid C type name ~A" host-type)))) + (defun host-type->lisp-type (name) - (let ((output (host-type-record-unsafe name))) - (cond (output - (host-type-lisp-type output)) + (let ((output (host-type-record-unsafe name)) + (ffi-type (when ffi::*ffi-types* + (gethash name ffi::*ffi-types*)))) + (cond (output (host-type-lisp-type output)) + (ffi-type (host-type->lisp-type ffi-type)) ((lisp-type-p name) name) (t (error "Unknown representation type ~S" name))))) -- GitLab