[Ecls-list] amendment

Brian Spilsbury brian.spilsbury at gmail.com
Mon Dec 25 05:09:13 UTC 2006


I just realized that that patch has the wrong version of this code.
This version was being dynamically patched in when I tested :(

Must run,
Brian.

src/lsp/ffi.lisp:

(defun do-load-foreign-library (tmp &optional system-library)
  (let* ((path (cond ((pathnamep tmp) tmp)
                     ((probe-file (setf tmp (string tmp))) tmp)
                     (t (compile-file-pathname tmp :type #+msvc :lib
#-msvc :dll))))
         (filename (namestring path))
         (pack     (find-package "COMPILER"))
         (flag     (if system-library
                       (concatenate 'string "-l" tmp)
                       filename)))
    (unless (find filename ffi::+loaded-libraries+ :test #'string-equal)
      (setf (symbol-value (intern "*LD-FLAGS*" pack)) (concatenate
'string (symbol-value (intern "*LD-FLAGS*" pack)) " " flag))
      (setf (symbol-value (intern "*LD-BUNDLE-FLAGS*" pack))
(concatenate 'string (symbol-value (intern "*LD-BUNDLE-FLAGS*" pack))
" " flag))
      (setf (symbol-value (intern "*LD-SHARED-FLAGS*" pack))
(concatenate 'string (symbol-value (intern "*LD-SHARED-FLAGS*" pack))
" " flag))
      (push filename ffi::+loaded-libraries+))
    t))

(defmacro load-foreign-library (filename &key system-library module
supporting-libraries force-load)
  (declare (ignore module force-load supporting-libraries))
  (let ((compile-form (and (constantp filename)
                           `((eval-when (:compile-toplevel)
                               (do-load-foreign-library ,filename
,system-library)))))
        (dyn-form #+dffi (when (and (not system-library) si::*use-dffi*)
                           `((si:load-foreign-module ,filename)))
                  #-dffi nil))
    `(progn , at compile-form , at dyn-form))))




More information about the ecl-devel mailing list