(define sys:load-preload-check
(lambda (libname)
(if (not (or (symbol? libname) (string? libname)))
(sys:load-escape "Error: lib-name must be symbol or string."))
(if (not (string=? (ipc:get-process-name) "primary"))
(sys:load-escape "Error: xtlang code must be compiled in the primary process."))
(if (defined? (string->symbol (string-append "*xtmlib-" (atom->string libname) "-loaded*")))
(sys:load-escape (string-append (atom->string libname) " already loaded")))))