X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=src%2Flibraries.lisp;h=faa5f12c2ef44efab56d6f4f4a7bcd5bb3507352;hb=88b6725ddf5bb4e3fdaaf1a5fc0e331d7371b41b;hp=cb6b168e53b0a0b9d9c10790213708b3696a79be;hpb=eb39da2ec2671e34b72702ace3ca31ed7076b47b;p=uffi.git diff --git a/src/libraries.lisp b/src/libraries.lisp index cb6b168..faa5f12 100644 --- a/src/libraries.lisp +++ b/src/libraries.lisp @@ -32,7 +32,7 @@ #-(or win32 mswindows macosx darwin ccl-5.0) '("so" "a" "o") ) -(defun find-foreign-library (names directories &key types drive-letters) +(defun find-foreign-library (names directories &key types drive-letters) "Looks for a foreign library. directories can be a single string or a list of strings of candidate directories. Use default library type if type is not specified." @@ -45,6 +45,9 @@ library type if type is not specified." (unless (listp directories) (setq directories (list directories))) #+(or win32 mswindows) + (unless drive-letters + (setq drive-letters (list (pathname-device directories)))) + #+(or win32 mswindows) (unless (listp drive-letters) (setq drive-letters (list drive-letters))) #-(or win32 mswindows) @@ -53,21 +56,21 @@ library type if type is not specified." (dolist (name names) (dolist (dir directories) (dolist (type types) - (let ((path (make-pathname + (let ((path (make-pathname #+lispworks :host #+lispworks (when drive-letter drive-letter) #-lispworks :device #-lispworks (when drive-letter drive-letter) - :name name + :name name :type type - :directory + :directory (etypecase dir (pathname (pathname-directory dir)) (list dir) (string - (pathname-directory + (pathname-directory (parse-namestring dir))))))) (when (probe-file path) (return-from find-foreign-library path))))))) @@ -76,19 +79,19 @@ library type if type is not specified." (defun load-foreign-library (filename &key module supporting-libraries force-load) - #+(or allegro mcl) (declare (ignore module supporting-libraries)) - #+(or cmu scl sbcl) (declare (ignore module)) + #+(or allegro openmcl digitool sbcl) (declare (ignore module supporting-libraries)) + #+(or cmu scl) (declare (ignore module)) #+lispworks (declare (ignore supporting-libraries)) (when (and filename (or (null (pathname-directory filename)) (probe-file filename))) (if (pathnamep filename) ;; ensure filename is a string to check if already loaded (setq filename (namestring (if (null (pathname-directory filename)) - filename + filename ;; lispworks treats as UNC, so use truename #+(and lispworks win32) (truename filename) #-(and lispworks win32) filename)))) - + (if (and (not force-load) (find filename *loaded-libraries* :test #'string-equal)) t ;; return T, but don't reload library @@ -97,13 +100,13 @@ library type if type is not specified." (let ((type (pathname-type (parse-namestring filename)))) (if (string-equal type "so") (sys::load-object-file filename) - (alien:load-foreign filename + (alien:load-foreign filename :libraries (convert-supporting-libraries-to-string supporting-libraries)))) #+scl (let ((type (pathname-type (parse-namestring filename)))) - (alien:load-foreign filename + (alien:load-foreign filename :libraries (convert-supporting-libraries-to-string supporting-libraries))) @@ -118,8 +121,8 @@ library type if type is not specified." :connection-style :immediate) #+allegro (load filename) #+openmcl (ccl:open-shared-library filename) - #+(and mcl (not openmcl)) (ccl:add-to-shared-library-search-path filename t) - + #+digitool (ccl:add-to-shared-library-search-path filename t) + (push filename *loaded-libraries*) t))))