ffi: Search the library path for shims and their C types/const.
authorMatt Birkholz <matt@birkholz.chandler.az.us>
Sat, 31 Aug 2013 22:18:27 +0000 (15:18 -0700)
committerMatt Birkholz <matt@birkholz.chandler.az.us>
Sat, 31 Aug 2013 22:18:27 +0000 (15:18 -0700)
src/ffi/syntax.scm
src/runtime/ffi.scm

index 83f05de4516a69c2bd26799945c9c33b951170b0..453be667886a5b77e3b4003817cd76ad3b5dc61e 100644 (file)
@@ -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
index 0c3f7f8f496f6184aa5fd6b80ea9f702336bffd2..763c2698dc9878e2ce9c3166b59d85832aacde48 100644 (file)
@@ -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))))