Changeset 14648
- Timestamp:
- Feb 8, 2011, 10:56:41 AM (14 years ago)
- File:
-
- 1 edited
-
trunk/source/level-1/linux-files.lisp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/level-1/linux-files.lisp
r14646 r14648 1018 1018 (unload-library-entrypoints nil)))))) 1019 1019 1020 #+darwin-target 1021 ;; completely specifies whether to remove it totally from our list 1022 (defun close-shared-library (lib &key (completely nil)) 1023 "If completely is T, set the reference count of library to 0. Otherwise, 1024 decrements it by 1. In either case, if the reference count becomes 0, 1025 close-shared-library frees all memory resources consumed library and causes 1026 any EXTERNAL-ENTRY-POINTs known to be defined by it to become unresolved." 1027 (let* ((lib (if (typep lib 'string) 1028 (or (shared-library-with-name lib) 1029 (error "Shared library ~s not found." lib)) 1030 (require-type lib 'shlib)))) 1031 ;; no possible danger closing libsystem since dylibs can't be closed 1032 (cond 1033 ((or (not (shlib.map lib)) (not (shlib.base lib))) 1034 (error "Shared library ~s uninitialized." (shlib.soname lib))) 1035 ((and (not (%null-ptr-p (shlib.map lib))) 1036 (%null-ptr-p (shlib.base lib))) 1037 (warn "Dynamic libraries cannot be closed on Darwin.")) 1038 ((and (%null-ptr-p (shlib.map lib)) 1039 (not (%null-ptr-p (shlib.base lib)))) 1040 ;; we have a bundle type library not sure what to do with the 1041 ;; completely flag when we open the same bundle more than once, 1042 ;; Darwin gives back a new module address, so we have multiple 1043 ;; entries on *shared-libraries* the best we can do is unlink 1044 ;; the module asked for (or our best guess based on name) and 1045 ;; invalidate any entries which refer to this container 1046 (if (= 0 (#_NSUnLinkModule (shlib.base lib) #$NSUNLINKMODULE_OPTION_NONE)) 1047 (error "Unable to close shared library, NSUnlinkModule failed.") 1048 (progn 1049 (setf (shlib.map lib) nil 1050 (shlib.base lib) nil) 1051 (unload-library-entrypoints lib) 1052 (when completely 1053 (setq *shared-libraries* (delete lib *shared-libraries*))))))))) 1020 1054 1021 1055 1022
Note:
See TracChangeset
for help on using the changeset viewer.
