;;;; Programmers: Kevin M. Rosenberg and John DeSoi
;;;; Date Started: Feb 2002
;;;;
-;;;; $Id: libraries.cl,v 1.1 2002/09/16 17:57:43 kevin Exp $
+;;;; $Id: libraries.cl,v 1.2 2002/09/20 04:51:14 kevin Exp $
;;;;
;;;; This file, part of UFFI, is Copyright (c) 2002 by Kevin M. Rosenberg
;;;; and John DeSoi
"List of foreign libraries loaded. Used to prevent reloading a library")
;in MCL calling this more than once for the same library does not do anything
-(defmacro load-foreign-library (filename &key module supporting-libraries)
- (declare (ignore module supporting-libraries))
+#-openmcl
+(defmacro load-foreign-library (filename &key module supporting-libraries force-load)
+ (declare (ignore module supporting-libraries force-load))
`(eval-when (:compile-toplevel :load-toplevel :execute)
(when (ccl:add-to-shared-library-search-path ,filename t)
(pushnew ,filename *loaded-libraries*))))
-;; Copied directly from main source without MCL specializations
+
+; Note we are not dealing with OpenMCL's ability to close the library
+; As of v0.13 .dylibs can't be closed but bundles can. See the docs for the latest.
+#+openmcl
+(defmacro load-foreign-library (filename &key module supporting-libraries force-load)
+ (declare (ignore module supporting-libraries force-load))
+ `(let ((path (if (pathnamep ,filename) (namestring ,filename) ,filename)))
+ (when (stringp path)
+ (if (position path *loaded-libraries* :test #'string-equal)
+ t
+ (when (ccl:open-shared-library path)
+ (pushnew path *loaded-libraries*)
+ t)))))
+
+
(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
nil)
-;; Copied directly from main source without MCL specializations
+
(defun default-foreign-library-type ()
"Returns string naming default library type for platform"
#+(or win32 mswindows) "dll"
- #-(or win32 mswindows) "so")
\ No newline at end of file
+ #-(or win32 mswindows mcl) "so"
+ #+openmcl '("dylib" "so" nil)
+ #-openmcl '(nil))
+
+
+
+
+
\ No newline at end of file