"Fossies" - the Fresh Open Source Software Archive

Member "snd-20.9/libdl.scm" (25 Jun 2020, 1151 Bytes) of package /linux/misc/snd-20.9.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Lisp source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 ;;; libdl.scm
    2 ;;;
    3 ;;; tie the dynamic loader library into the *libdl* environment
    4 
    5 (require cload.scm)
    6 (provide 'libdl.scm)
    7 
    8 ;; if loading from a different directory, pass that info to C
    9 (let ((directory (let ((current-file (port-filename)))
   10            (and (memv (current-file 0) '(#\/ #\~))
   11             (substring current-file 0 (- (length current-file) 9))))))
   12   (when (and directory (not (member directory *load-path*)))
   13     (set! *load-path* (cons directory *load-path*)))
   14   (with-let (rootlet)
   15     (require cload.scm))
   16   (when (and directory (not (string-position directory *cload-cflags*)))
   17     (set! *cload-cflags* (string-append "-I" directory " " *cload-cflags*))))
   18 
   19 
   20 (if (not (defined? '*libdl*))
   21     (define *libdl*
   22       (with-let (unlet)
   23     (set! *libraries* (cons (cons "libdl.scm" (curlet)) *libraries*))
   24     (c-define '((void* dlopen (char* int))
   25             (int dlclose (void*))
   26             (void* dlsym (void* char*))
   27             (char* dlerror (void))
   28             (C-macro (int (RTLD_LAZY RTLD_NOW RTLD_BINDING_MASK RTLD_NOLOAD RTLD_DEEPBIND RTLD_GLOBAL RTLD_LOCAL RTLD_NODELETE))))
   29           "" "dlfcn.h" "" "" "libdl_s7")
   30     (curlet))))
   31 
   32 *libdl*
   33 ;; the loader will return *libdl*