diff --git "a/cffi\\toolchain\\c-toolchain.lisp" "b/C:\\Users\\edanilenko\\quicklisp\\dists\\quicklisp\\software\\cffi-20231021-git\\toolchain\\c-toolchain.lisp" index 0077e3f..dce791e 100644 --- "a/cffi\\toolchain\\c-toolchain.lisp" +++ "b/C:\\Users\\edanilenko\\quicklisp\\dists\\quicklisp\\software\\cffi-20231021-git\\toolchain\\c-toolchain.lisp" @@ -42,7 +42,7 @@ (defun program-argument (x) (etypecase x (string x) - (pathname (native-namestring x)))) + (pathname (namestring x)))) (defun invoke (command &rest args) (when (pathnamep command) @@ -51,8 +51,8 @@ (unless (absolute-pathname-p command) (setf command (strcat "./" command)))) (let ((cmd (cons command (mapcar 'program-argument args)))) - (safe-format! *debug-io* "; ~A~%" (escape-command cmd)) - (run-program cmd :output :interactive :error-output :interactive))) + (safe-format! *debug-io* ";~A~%" (escape-command cmd)) + (run-program cmd :output :string :error-output :string :ignore-error-status t))) ;;; C support @@ -233,7 +233,7 @@ (defun call-with-temporary-output (output-file fun) - (let ((output-file (ensure-pathname output-file :want-file t :ensure-absolute t :truenamize t))) + (let ((output-file (ensure-pathname output-file :want-file t :ensure-absolute t :truenamize nil))) (with-temporary-file (:pathname tmp :direction :output :prefix (strcat (native-namestring (pathname-directory-pathname output-file)) @@ -241,7 +241,12 @@ :suffix "" :type (pathname-type output-file)) (funcall fun tmp) - (rename-file-overwriting-target tmp output-file)))) + (let ((replacement (str:replace-all "/mnt/c/" "C:/" (namestring output-file))) + (tmp-new (str:replace-all "/mnt/c/" "C:/" (namestring tmp)))) + ; (uiop:rename-file-overwriting-target tmp-new (str:concat "C:/temp/" (file-namestring output-file))) + (uiop:rename-file-overwriting-target tmp-new replacement) + ) + ))) (defmacro with-temporary-output ((output-file-var &optional (output-file-val output-file-var)) &body body) @@ -255,12 +260,12 @@ is bound to a temporary file name, then atomically renaming that temporary file (apply 'invoke `(,@builder ,output-file ,@args)))) (defun cc-compile (output-file inputs &optional cflags) - (apply 'invoke-builder (list *cc* "-o") output-file - "-c" (append *cc-flags* cflags #-windows '("-fPIC") inputs))) + (apply 'invoke-builder (list "wsl" "-e" *cc* "-o") (str:replace-all "C:/" "/mnt/c/" (namestring output-file)) + "-c" (append *cc-flags* cflags #-windows '("-fPIC") (mapcar #'(lambda (x) (str:replace-all "C:/" "/mnt/c/" (namestring x))) inputs)))) (defun link-executable (output-file inputs) - (apply 'invoke-builder (list *ld* "-o") output-file - (append *ld-exe-flags* inputs))) + (apply 'invoke-builder (list "wsl" "-e" *ld* "-o") (str:replace-all "C:/" "/mnt/c/" (namestring output-file)) + (append *ld-exe-flags* (mapcar #'(lambda (x) (str:replace-all "C:/" "/mnt/c/" (namestring x))) inputs)))) (defun link-lisp-executable (output-file inputs) #+ecl