[Ecls-list] calling ECL functions defined in an ASDF package from C code

Ph. Marek philipp at marek.priv.at
Thu Jul 14 19:34:45 UTC 2011


> Well, of course it would be fine if that dependency tracking could be done in
ECL ... so
> that having
>     (c:build...  (:include-modules '(alexandria cl-ppcre)))
> would automatically include all needed .o files.
>
> (For simplicity I'd say that the given dependencies need to be loaded in the
compiling
> ECL, so that it can simply use a list that was built upon loading them).
>
> Then it wouldn't really matter where they are, and neither if ql was used or
not ...

With help from #lisp I'm currently testing something like this; perhaps a
refined version could find its way into ECL?



(defvar *sources* (list "my/source/files.lisp" ...))

(let (libs o)
  (asdf:map-systems
    (lambda (s)
      (let ((dir (asdf:system-source-directory s)))
        ;(asdf:system-source-file *)
        (dolist (c (asdf:module-components s))
          (push (asdf:component-pathname c) libs)))))
  ;; compile into .o
  (dolist (src (append libs *sources*))
    ;; there are directories in this list, too
    (if (pathname-name src)
      (let* ((output-file
               (compile-file-pathname src
                                      :type :object))
             (of-time (or (file-write-date output-file) 0))
             (src-time (file-write-date src)))
        (format t "~&src ~a ~a: ~a~%" src-time of-time src)
        (if (< of-time src-time)
          (with-output-to-string (*standard-output*)
            (compile-file src :system-p t)))
        (push output-file o) )))
  ;;
  ;; build executable
  (c:build-program binary
                   :lisp-files o))






More information about the ecl-devel mailing list