From: Matt Birkholz Date: Sat, 31 Aug 2013 22:18:27 +0000 (-0700) Subject: ffi: Search the library path for shims and their C types/const. X-Git-Tag: release-9.2.0~133 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=6d0cca8d0d29fa5268f2429a5c9b55574a0837c6;p=mit-scheme.git ffi: Search the library path for shims and their C types/const. --- diff --git a/src/ffi/syntax.scm b/src/ffi/syntax.scm index 83f05de45..453be6678 100644 --- a/src/ffi/syntax.scm +++ b/src/ffi/syntax.scm @@ -66,19 +66,22 @@ USA. (receiver (cadr form))))) (define (load-c-includes library) - (let* ((lib (merge-pathnames library (system-library-directory-pathname))) - (name (pathname-name lib)) - (const (pathname-new-name lib (string-append name "-const"))) - (types (pathname-new-name lib (string-append name "-types"))) - (includes (fasload types (not c-include-noisily?))) - (comment (fasload const (not c-include-noisily?))) - (enums.struct-values - (if (comment? comment) (comment-expression comment) - (error:wrong-type-datum comment "a fasl comment")))) - (warn-new-cdecls includes) - (set-c-includes/enum-values! includes (car enums.struct-values)) - (set-c-includes/struct-values! includes (cadr enums.struct-values)) - includes)) + (let ((lib (system-library-pathname (string-append library "-shim.so")))) + (let ((includes (fasload + (pathname-new-name (pathname-new-type lib "bin") + (string-append library "-types")) + (not c-include-noisily?))) + (comment (fasload + (pathname-new-name (pathname-new-type lib "bin") + (string-append library "-const")) + (not c-include-noisily?)))) + (let ((enums.struct-values + (if (comment? comment) (comment-expression comment) + (error:wrong-type-datum comment "a fasl comment")))) + (warn-new-cdecls includes) + (set-c-includes/enum-values! includes (car enums.struct-values)) + (set-c-includes/struct-values! includes (cadr enums.struct-values)) + includes)))) (define (warn-new-cdecls includes) (for-each diff --git a/src/runtime/ffi.scm b/src/runtime/ffi.scm index 0c3f7f8f4..763c2698d 100644 --- a/src/runtime/ffi.scm +++ b/src/runtime/ffi.scm @@ -245,9 +245,9 @@ USA. unspecific (let* ((library (%alien-function/library afunc)) (name (%alien-function/name afunc)) - (pathname (merge-pathnames - (pathname-new-type (string-append library "-shim") "so") - (system-library-directory-pathname))) + (pathname (system-library-pathname + (pathname-new-type (string-append library"-shim") + "so"))) (handle (or (find-dld-handle (lambda (h) (pathname=? pathname (dld-handle-pathname h))))