Compare commits

...

4 commits

Author SHA1 Message Date
Dmitry Solomennikov
eee3007827 Merge branch 'ffi-foreign-types' into 'develop'
Draft: Allow usage of (ffi:def-foreign-type ... ) in function declaration

See merge request embeddable-common-lisp/ecl!356
2025-11-25 14:49:41 +00:00
Daniel Kochmański
34afd9a6d3 compile-file: allow :LOAD T :SYSTEM-P T when cross-compiling
We don't need to load the compilation artifact, so there is no reason to error.
2025-11-24 14:47:53 +01:00
Daniel Kochmański
e09f0d9742 cmpdefs: fix builds for CC [dlopen host -> no-dlopen target]
(DEFCONFIG *LD-SHARED-FLAGS*) was called without a value when dlopen was not
defined, that lead to error when destructuring. We put there "" instead now.
2025-11-24 10:58:15 +01:00
Dmitry Solomennikov
bb3f48af4e Allow usage of (ffi:def-foreign-type ... )
Signed-off-by: Dmitry Solomennikov <dmitrys99@mail.ru>
2025-08-14 15:31:13 +03:00
3 changed files with 21 additions and 14 deletions

View file

@ -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)))))

View file

@ -52,20 +52,19 @@ coprocessor).")
#+msvc "~A -Fe~S~* ~{~S ~} ~@[~S~]~{ '~A'~} ~A")
(defconfig *cc-format* (cond ((member :msvc *features*)
"~A -I. \"-I~A\" ~A ~:[~*~;~A~] -w -c \"~A\" -o \"~A\"~{ '~A'~}")
((member :nacl *features*) ;; pnacl-clang doesn't support -w
"~A -I. \"-I~A\" ~A ~:[~*~;~A~] -c \"~A\" -o \"~A\"~{ '~A'~}")
(t
"~A -I. \"-I~A\" ~A ~:[~*~;~A~] -w -c \"~A\" -o \"~A\"~{ '~A'~}")))
"~A -I. \"-I~A\" ~A ~:[~*~;~A~] -w -c \"~A\" -o \"~A\"~{ '~A'~}")
((member :nacl *features*) ;; pnacl-clang doesn't support -w
"~A -I. \"-I~A\" ~A ~:[~*~;~A~] -c \"~A\" -o \"~A\"~{ '~A'~}")
(t
"~A -I. \"-I~A\" ~A ~:[~*~;~A~] -w -c \"~A\" -o \"~A\"~{ '~A'~}")))
(defconfig *ld-flags* "@LDFLAGS@")
#-dlopen
(defconfig *ld-libs* "-lecl @CORE_LIBS@ @FASL_LIBS@ @LIBS@")
#+dlopen
(defconfig *ld-libs* #-msvc "-lecl @FASL_LIBS@ @LIBS@"
#+msvc "ecl.lib @CLIBS@")
(defconfig *ld-shared-flags* #+dlopen "@SHARED_LDFLAGS@ @LDFLAGS@")
(defconfig *ld-bundle-flags* #+dlopen "@BUNDLE_LDFLAGS@ @LDFLAGS@")
(defconfig *ld-libs* #-msvc "-lecl @FASL_LIBS@ @LIBS@" #+msvc "ecl.lib @CLIBS@")
(defconfig *ld-shared-flags* #+dlopen "@SHARED_LDFLAGS@ @LDFLAGS@" #-dlopen "")
(defconfig *ld-bundle-flags* #+dlopen "@BUNDLE_LDFLAGS@ @LDFLAGS@" #-dlopen "")
(defconfig *ld-program-flags* "@PROGRAM_LDFLAGS@ @LDFLAGS@")
(defconfig +shared-library-prefix+ "@SHAREDPREFIX@")

View file

@ -101,7 +101,7 @@ compiled successfully, returns the pathname of the compiled file."
(setq *compile-file-pathname* (make-pathname :type ext :defaults input-pathname))
(when (probe-file *compile-file-pathname*)
(return)))))
(when (and system-p load)
(when (and system-p load (not *cross-compiling*))
(error "Cannot load system files."))
(cmpprogress "~&;;;~%;;; Compiling ~a~:[~; for target ~a~]."
(namestring input-pathname)