mirror of
https://github.com/justinethier/cyclone.git
synced 2025-07-14 08:17:35 +02:00
Load unloaded or explicitly imported libs
This commit is contained in:
parent
3993a4d277
commit
4dd72a876c
1 changed files with 8 additions and 4 deletions
|
@ -604,18 +604,22 @@
|
||||||
;;
|
;;
|
||||||
;; TODO: for some imports (prefix, maybe other stuff), can we do the renaming in the env??
|
;; TODO: for some imports (prefix, maybe other stuff), can we do the renaming in the env??
|
||||||
(define (%import . import-sets)
|
(define (%import . import-sets)
|
||||||
(let ((lib-names (lib:get-all-import-deps import-sets '() '())))
|
(let (;; Libraries explicitly listed in the import expression
|
||||||
|
(explicit-lib-names
|
||||||
|
(map lib:import->library-name (lib:list->import-set import-sets)))
|
||||||
|
;; All dependent libraries
|
||||||
|
(lib-names (lib:get-all-import-deps import-sets '() '())))
|
||||||
(for-each
|
(for-each
|
||||||
(lambda (lib-name)
|
(lambda (lib-name)
|
||||||
(let* ((us (lib:name->unique-string lib-name))
|
(let* ((us (lib:name->unique-string lib-name))
|
||||||
(loaded? (c:lib-loaded? us)))
|
(loaded? (c:lib-loaded? us)))
|
||||||
;; TODO: some kind of bug here, seems libraries are never registered as loaded
|
(if (or (not loaded?)
|
||||||
(if (not loaded?)
|
(member lib-name explicit-lib-names))
|
||||||
(c:import-shared-obj
|
(c:import-shared-obj
|
||||||
(lib:import->filename lib-name ".so")
|
(lib:import->filename lib-name ".so")
|
||||||
(string-append
|
(string-append
|
||||||
"c_" (lib:name->string lib-name) "_entry_pt_first_lambda"))
|
"c_" (lib:name->string lib-name) "_entry_pt_first_lambda"))
|
||||||
(begin (write `(,lib-name ,us ,loaded? is already loaded skipping)) (newline))
|
;(begin (write `(,lib-name ,us ,loaded? is already loaded skipping)) (newline))
|
||||||
)))
|
)))
|
||||||
lib-names)
|
lib-names)
|
||||||
(set! *global-environment* (setup-environment *initial-environment*))
|
(set! *global-environment* (setup-environment *initial-environment*))
|
||||||
|
|
Loading…
Add table
Reference in a new issue