r10575: 09 Jun 2005 Kevin Rosenberg <kevin@rosenberg.net>
authorKevin M. Rosenberg <kevin@rosenberg.net>
Wed, 8 Jun 2005 19:25:26 +0000 (19:25 +0000)
committerKevin M. Rosenberg <kevin@rosenberg.net>
Wed, 8 Jun 2005 19:25:26 +0000 (19:25 +0000)
        * clsql-mysql.asd: Renamed uffi/mysql interface library from
        mysql to uffi_mysql
        * db-mysql/uffi_mysql.c: Renamed from mysql.c
        * db-mysql/Makefile, db-mysql/mysql-loader.lisp: Rename shared library
        * db-*/*-loader.lisp: Commit big patch from Edi Weitz to remove
        absolute pathnames when searching for foreign libraries.
        * uffi/clsql-uffi-loader: New file from Edi Weitz for support
        foreign library loading.

14 files changed:
ChangeLog
clsql-mysql.asd
db-db2/db2-loader.lisp
db-mysql/Makefile
db-mysql/clsql_mysql.c [new file with mode: 0644]
db-mysql/uffi_mysql.c [deleted file]
db-odbc/odbc-loader.lisp
db-oracle/oracle-loader.lisp
db-postgresql/postgresql-loader.lisp
db-sqlite/sqlite-loader.lisp
db-sqlite3/sqlite3-loader.lisp
debian/changelog
uffi/clsql-uffi-loader.lisp
uffi/clsql-uffi-package.lisp

index b3df41b0f7f509a98f9d7704264de479dee192a2..42b193d7b220b6977e6e7525cb06e27638fcbd99 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+09 Jun 2005 Kevin Rosenberg <kevin@rosenberg.net>
+       * clsql-mysql.asd: Renamed uffi/mysql interface library from
+       mysql to uffi_mysql
+       * db-mysql/uffi_mysql.c: Renamed from mysql.c
+       * db-mysql/Makefile, db-mysql/mysql-loader.lisp: Rename shared library
+       * db-*/*-loader.lisp: Commit big patch from Edi Weitz to remove
+       absolute pathnames when searching for foreign libraries.
+       * uffi/clsql-uffi-loader: New file from Edi Weitz for support
+       foreign library loading.
+       
 07 Jun 2005 Kevin Rosenberg <kevin@rosenberg.net>
        * Version 3.1.16
        * db-mysql/mysql-api.lisp: Commit patch from Espen Wiborn
index 378082763c040675a8d23860eb0df24e2847e065..009217555237a931b8bc8dfba342677268d0a66d 100644 (file)
@@ -64,7 +64,7 @@
       (error 'operation-error :component c :operation o))))
 
 (defmethod operation-done-p ((o compile-op) (c clsql-mysql-source-file))
-  (or (and (probe-file #p"/usr/lib/clsql/mysql.so") t)
+  (or (and (probe-file #p"/usr/lib/clsql/clsql_mysql.so") t)
       (let ((lib (make-pathname :defaults (component-pathname c)
                                :type (uffi:default-foreign-library-type))))
        (and (probe-file lib)
index 70be07828ee9cbc0a35c55b8a0f47efcaa85aaee..8faf9e39316776c4ac25279afd899b4d6740b96b 100644 (file)
                     (append 
                      (pathname-directory
                       (parse-namestring (concatenate 'string db2-home "/")))
-                       (list "lib"))))))
+                      (list "lib"))))))
 
-(defparameter *db2-client-library-path* 
-    (uffi:find-foreign-library
-     "libdb2"
-     `(,@(when *load-truename* (list (make-pathname :directory (pathname-directory *load-truename*))))
-       ,@(when *db2-lib-path* (list *db2-lib-path*))
-       #+64bit "/opt/IBM/db2/V8.1/lib64/"
-       "/opt/IBM/db2/V8.1/lib/")
-     :drive-letters '("C")))
+(defparameter *db2-library-filenames*
+  (if *db2-lib-path*
+    (list (merge-pathnames "libdb2" *db2-lib-path*)
+          "libdb2")
+    "libdb2"))
 
 (defvar *db2-supporting-libraries* '("c")
   "Used only by CMU. List of library flags needed to be passed to ld to
@@ -46,14 +43,11 @@ set to the right path before compiling or loading the system.")
   *db2-library-loaded*)
 
 (defmethod clsql-sys:database-type-load-foreign ((database-type (eql :db2)))
-  (if (pathnamep *db2-client-library-path*) 
-      (progn
-       (uffi:load-foreign-library *db2-client-library-path*
-                                  :module "clsql-db2"
-                                  :supporting-libraries 
-                                  *db2-supporting-libraries*)
-       (setq *db2-library-loaded* t))
-      (warn "Unable to load db2 client library.")))
+  (clsql-uffi:find-and-load-foreign-library *db2-library-filenames*
+                                            :module "clsql-db2"
+                                            :supporting-libraries 
+                                            *db2-supporting-libraries*)
+  (setq *db2-library-loaded* t))
 
 (clsql-sys:database-type-load-foreign :db2)
 
index dd47bc5d846c43ac6a9f4b0c07edebe26f685479..bd3cfd2506b61e6ac7744e44f0d2b9f708289425 100644 (file)
@@ -17,10 +17,11 @@ SUBDIRS=
 
 include ../Makefile.common
 
-base=uffi_mysql
+base=clsql_mysql
 source=$(base).c
 object=$(base).o
-shared_lib=uffi_mysql.so
+shared_lib=$(base).so
+
 
 .PHONY: all
 all: $(shared_lib)
diff --git a/db-mysql/clsql_mysql.c b/db-mysql/clsql_mysql.c
new file mode 100644 (file)
index 0000000..d1bb084
--- /dev/null
@@ -0,0 +1,153 @@
+/****************************************************************************
+ * FILE IDENTIFICATION
+ *
+ *   Name:          clsql-mysql.c
+ *   Purpose:       Helper functions for mysql.cl to handle 64-bit parts of API
+ *   Programmer:    Kevin M. Rosenberg
+ *   Date Started:  Mar 2002
+ *
+ * $Id$
+ *
+ * This file, part of CLSQL, is Copyright (c) 2002 by Kevin M. Rosenberg
+ *
+ * CLSQL users are granted the rights to distribute and use this software
+ * as governed by the terms of the Lisp Lesser GNU Public License
+ * (http://opensource.franz.com/preamble.html), also known as the LLGPL.
+ ***************************************************************************/
+
+#ifdef WIN32
+#include <windows.h>
+
+BOOL WINAPI DllEntryPoint(HINSTANCE hinstdll, DWORD fdwReason,
+                         LPVOID lpvReserved)
+{
+        return 1;
+}
+       
+#define DLLEXPORT __declspec(dllexport)
+
+#else
+#define DLLEXPORT 
+#endif
+
+
+#include <mysql.h>
+
+/* Need to assemble a 64-bit integer to send to MySQL */
+DLLEXPORT
+void
+clsql_mysql_data_seek (MYSQL_RES* res, unsigned int offset_high32,
+                      unsigned int offset_low32)
+{
+  my_ulonglong offset;
+
+  offset = offset_high32;
+  offset = offset << 32;
+  offset += offset_low32;
+  
+  mysql_data_seek (res, offset);
+}
+
+/* The following functions are used to return 64-bit integers to Lisp.
+   They return the 32-bit low part and store in upper 32-bits in a 
+   located sent via a pointer */
+
+static const unsigned int bitmask_32bits = 0xFFFFFFFF;
+#define lower_32bits(int64) ((unsigned int) int64 & bitmask_32bits)
+#define upper_32bits(int64) ((unsigned int) (int64 >> 32))
+
+DLLEXPORT
+unsigned int
+clsql_mysql_num_rows (MYSQL_RES* res, unsigned int* pHigh32)
+{
+  my_ulonglong nRows = mysql_num_rows (res);
+  *pHigh32 = upper_32bits(nRows);
+  return lower_32bits(nRows);
+}
+
+DLLEXPORT
+unsigned int
+clsql_mysql_affected_rows (MYSQL* res, unsigned int* pHigh32)
+{
+  my_ulonglong nAffected = mysql_affected_rows (res);
+  *pHigh32 = upper_32bits(nAffected);
+  return lower_32bits(nAffected);
+}
+
+DLLEXPORT
+unsigned int
+clsql_mysql_insert_id (MYSQL* mysql, unsigned int* pHigh32)
+{
+  my_ulonglong insert_id = mysql_insert_id (mysql);
+  *pHigh32 = upper_32bits(insert_id);
+  return lower_32bits(insert_id);
+}
+
+
+/* Accessor functions to hide the differences across MySQL versions */
+
+DLLEXPORT
+short int
+clsql_mysql_field_type (MYSQL_FIELD* field)
+{
+  return field->type;
+}
+
+DLLEXPORT
+char*
+clsql_mysql_field_name (MYSQL_FIELD* field)
+{
+  return field->name;
+}
+
+DLLEXPORT
+unsigned long
+clsql_mysql_field_length (MYSQL_FIELD* field)
+{
+  return field->length;
+}
+
+DLLEXPORT
+unsigned long
+clsql_mysql_field_max_length (MYSQL_FIELD* field)
+{
+  return field->max_length;
+}
+
+
+#if MYSQL_VERSION_ID >= 40102
+#include <stdlib.h>
+
+DLLEXPORT
+MYSQL_BIND*
+allocate_bind (unsigned int n)
+{
+  return (MYSQL_BIND*) malloc (n * sizeof(MYSQL_BIND));
+}
+
+DLLEXPORT
+void
+bind_param (MYSQL_BIND bind[], unsigned int n, unsigned long length, unsigned short is_null, 
+          void* buffer, unsigned short buffer_type, unsigned long buffer_length)
+{
+  *bind[n].length = length;
+  *bind[n].is_null = is_null;
+  bind[n].buffer = buffer;
+  bind[n].buffer_type = buffer_type;
+  bind[n].buffer_length = buffer_length;
+}
+
+
+DLLEXPORT
+DLLEXPORT
+unsigned int
+clsql_mysql_stmt_affected_rows (MYSQL_STMT* stmt, unsigned int* pHigh32)
+{
+  my_ulonglong nAffected = mysql_stmt_affected_rows (stmt);
+  *pHigh32 = upper_32bits(nAffected);
+  return lower_32bits(nAffected);
+}
+
+
+#endif
+
diff --git a/db-mysql/uffi_mysql.c b/db-mysql/uffi_mysql.c
deleted file mode 100644 (file)
index d1bb084..0000000
+++ /dev/null
@@ -1,153 +0,0 @@
-/****************************************************************************
- * FILE IDENTIFICATION
- *
- *   Name:          clsql-mysql.c
- *   Purpose:       Helper functions for mysql.cl to handle 64-bit parts of API
- *   Programmer:    Kevin M. Rosenberg
- *   Date Started:  Mar 2002
- *
- * $Id$
- *
- * This file, part of CLSQL, is Copyright (c) 2002 by Kevin M. Rosenberg
- *
- * CLSQL users are granted the rights to distribute and use this software
- * as governed by the terms of the Lisp Lesser GNU Public License
- * (http://opensource.franz.com/preamble.html), also known as the LLGPL.
- ***************************************************************************/
-
-#ifdef WIN32
-#include <windows.h>
-
-BOOL WINAPI DllEntryPoint(HINSTANCE hinstdll, DWORD fdwReason,
-                         LPVOID lpvReserved)
-{
-        return 1;
-}
-       
-#define DLLEXPORT __declspec(dllexport)
-
-#else
-#define DLLEXPORT 
-#endif
-
-
-#include <mysql.h>
-
-/* Need to assemble a 64-bit integer to send to MySQL */
-DLLEXPORT
-void
-clsql_mysql_data_seek (MYSQL_RES* res, unsigned int offset_high32,
-                      unsigned int offset_low32)
-{
-  my_ulonglong offset;
-
-  offset = offset_high32;
-  offset = offset << 32;
-  offset += offset_low32;
-  
-  mysql_data_seek (res, offset);
-}
-
-/* The following functions are used to return 64-bit integers to Lisp.
-   They return the 32-bit low part and store in upper 32-bits in a 
-   located sent via a pointer */
-
-static const unsigned int bitmask_32bits = 0xFFFFFFFF;
-#define lower_32bits(int64) ((unsigned int) int64 & bitmask_32bits)
-#define upper_32bits(int64) ((unsigned int) (int64 >> 32))
-
-DLLEXPORT
-unsigned int
-clsql_mysql_num_rows (MYSQL_RES* res, unsigned int* pHigh32)
-{
-  my_ulonglong nRows = mysql_num_rows (res);
-  *pHigh32 = upper_32bits(nRows);
-  return lower_32bits(nRows);
-}
-
-DLLEXPORT
-unsigned int
-clsql_mysql_affected_rows (MYSQL* res, unsigned int* pHigh32)
-{
-  my_ulonglong nAffected = mysql_affected_rows (res);
-  *pHigh32 = upper_32bits(nAffected);
-  return lower_32bits(nAffected);
-}
-
-DLLEXPORT
-unsigned int
-clsql_mysql_insert_id (MYSQL* mysql, unsigned int* pHigh32)
-{
-  my_ulonglong insert_id = mysql_insert_id (mysql);
-  *pHigh32 = upper_32bits(insert_id);
-  return lower_32bits(insert_id);
-}
-
-
-/* Accessor functions to hide the differences across MySQL versions */
-
-DLLEXPORT
-short int
-clsql_mysql_field_type (MYSQL_FIELD* field)
-{
-  return field->type;
-}
-
-DLLEXPORT
-char*
-clsql_mysql_field_name (MYSQL_FIELD* field)
-{
-  return field->name;
-}
-
-DLLEXPORT
-unsigned long
-clsql_mysql_field_length (MYSQL_FIELD* field)
-{
-  return field->length;
-}
-
-DLLEXPORT
-unsigned long
-clsql_mysql_field_max_length (MYSQL_FIELD* field)
-{
-  return field->max_length;
-}
-
-
-#if MYSQL_VERSION_ID >= 40102
-#include <stdlib.h>
-
-DLLEXPORT
-MYSQL_BIND*
-allocate_bind (unsigned int n)
-{
-  return (MYSQL_BIND*) malloc (n * sizeof(MYSQL_BIND));
-}
-
-DLLEXPORT
-void
-bind_param (MYSQL_BIND bind[], unsigned int n, unsigned long length, unsigned short is_null, 
-          void* buffer, unsigned short buffer_type, unsigned long buffer_length)
-{
-  *bind[n].length = length;
-  *bind[n].is_null = is_null;
-  bind[n].buffer = buffer;
-  bind[n].buffer_type = buffer_type;
-  bind[n].buffer_length = buffer_length;
-}
-
-
-DLLEXPORT
-DLLEXPORT
-unsigned int
-clsql_mysql_stmt_affected_rows (MYSQL_STMT* stmt, unsigned int* pHigh32)
-{
-  my_ulonglong nAffected = mysql_stmt_affected_rows (stmt);
-  *pHigh32 = upper_32bits(nAffected);
-  return lower_32bits(nAffected);
-}
-
-
-#endif
-
index 07c77b0f968aa6026184dad8c6e7180080dd632d..b63a25a95ec38ba02ec2ac78683aea5ba9fadac7 100644 (file)
 
 (in-package #:odbc)
 
-(defparameter *odbc-library-path* 
-  (uffi:find-foreign-library
-   '("odbc32" "libodbc" "libiodbc")
-   `(,(make-pathname :directory (pathname-directory *load-truename*))
-     #+64bit "/usr/lib64/"
-     "/usr/lib/"
-     "/sw/lib/"
-     "/usr/local/lib/"
-     "/home/kevin/debian/src/clsql/db-odbc/"
-     "/windows/system32/"
-     "/winnt/system32/"
-     "/odbc/lib/opt/")
-   :drive-letters '("C")))
+(defparameter *odbc-library-filenames* 
+  '("odbc32" "libodbc" "libiodbc"))
   
 (defvar *odbc-supporting-libraries* '("c")
   "Used only by CMU. List of library flags needed to be passed to ld to
@@ -44,8 +33,8 @@ set to the right path before compiling or loading the system.")
   *odbc-library-loaded*)
                                      
 (defmethod clsql-sys:database-type-load-foreign ((database-type (eql :odbc)))
-  (uffi:load-foreign-library *odbc-library-path*
-                            :module "odbc") 
+  (clsql-uffi:find-and-load-foreign-library *odbc-library-filenames*
+                                            :module "odbc")
   (setq *odbc-library-loaded* t))
 
 (clsql-sys:database-type-load-foreign :odbc)
index 72414029fb862ad234a02ae811f732220d4b66d0..9a970d36fa28e8f172bbee86e6221e23e02f8ae5 100644 (file)
       (parse-namestring (concatenate 'string oracle-home "/"))))
   "Pathname of ORACLE_HOME as set in user environment.")
 
-(defparameter *oracle-client-library-path* 
-    (uffi:find-foreign-library
-     '("libclntsh" "oci")
-     `(,@(when *load-truename*
-          (list (make-pathname
-                 :directory (pathname-directory *load-truename*))))
-        ,@(when *oracle-home*
-            (list
-             (make-pathname :defaults *oracle-home*
-                            :directory 
-                            (append (pathname-directory *oracle-home*)
-                                    (list "lib")))
-             (make-pathname :defaults *oracle-home*
-                            :directory 
-                            (append (pathname-directory *oracle-home*)
-                                    (list "bin")))))
-        "/usr/lib/oracle/10.1.0.2/client/lib/")
-     :drive-letters '("C")))
+(defparameter *oracle-client-library-filenames*
+  (list* "libclntsh" "oci"
+         (when *oracle-home*
+           (loop for dir-name in '("lib" "bin")
+                 nconc (loop for lib-name in '("libclntsh" "oci")
+                             collect (make-pathname :defaults lib-name
+                                                    :directory (append (pathname-directory *oracle-home*)
+                                                                       (list dir-name))))))))
 
 (defvar *oracle-supporting-libraries* '("c")
   "Used only by CMU. List of library flags needed to be passed to ld to
@@ -53,14 +43,10 @@ set to the right path before compiling or loading the system.")
   *oracle-library-loaded*)
 
 (defmethod clsql-sys:database-type-load-foreign ((database-type (eql :oracle)))
-  (if (pathnamep *oracle-client-library-path*) 
-      (progn
-       (uffi:load-foreign-library *oracle-client-library-path*
-                                  :module "clsql-oracle"
-                                  :supporting-libraries 
-                                  *oracle-supporting-libraries*)
-       (setq *oracle-library-loaded* t))
-      (warn "Unable to load oracle client library.")))
+  (clsql-uffi:find-and-load-foreign-library *oracle-client-library-filenames*
+                                            :module "clsql-oracle"
+                                            :supporting-libraries *oracle-supporting-libraries*)
+  (setq *oracle-library-loaded* t))
 
 (clsql-sys:database-type-load-foreign :oracle)
 
index a7fefa9eceba5fd747673279ee659efdf9a13509..8124bb924029cedc4f59e236fc0e367dd5b0dbfe 100644 (file)
@@ -33,24 +33,10 @@ set to the right path before compiling or loading the system.")
                                      
 (defmethod clsql-sys:database-type-load-foreign ((database-type
                                                  (eql :postgresql)))
-  (let ((libpath (uffi:find-foreign-library 
-                 "libpq"
-                 '("/opt/postgresql/lib/" "/usr/local/lib/" 
-                   #+(or 64bit x86-64) "/usr/lib64/"
-                   "/usr/lib/" "/postgresql/lib/"
-                   "/usr/local/pgsql/lib/" "/usr/lib/pgsql/"
-                   "/opt/pgsql/lib/pgsql" "/sw/lib/pgsql/" "/sw/lib/"
-                   "/windows/system32/")
-                 :drive-letters '("C" "D" "E")
-                 #+(or macosx darwin ccl-5.0) :types
-                 #+(or macosx darwin ccl-5.0) '("so" "dylib")
-                 )))
-    (if        (uffi:load-foreign-library libpath
-                                  :module "postgresql"
-                                  :supporting-libraries 
-                                  *postgresql-supporting-libraries*)
-       (setq *postgresql-library-loaded* t)
-      (warn "Can't load PostgreSQL client library ~A" libpath))))
+  (clsql-uffi:find-and-load-foreign-library "libpq"
+                                            :module "postgresql"
+                                            :supporting-libraries *postgresql-supporting-libraries*)
+  (setq *postgresql-library-loaded* t))
 
 (clsql-sys:database-type-load-foreign :postgresql)
 
index 59baaee3822d4cfe8d81b0a0dcb477775e1c27ab..27bea2027750a8a60c4e71fb85f002f91ba29065 100644 (file)
@@ -31,17 +31,10 @@ set to the right path before compiling or loading the system.")
   *sqlite-library-loaded*)
 
 (defmethod database-type-load-foreign ((database-type (eql :sqlite)))
-  (let ((libpath (uffi:find-foreign-library
-                 '("libsqlite" "sqlite")
-                 '(#+64bit "/usr/lib64/"
-                   "/usr/lib/" "/usr/local/lib/" "/bin/")
-                 :drive-letters '("C" "D" "E"))))
-    (if (uffi:load-foreign-library libpath
-                                  :module "sqlite"
-                                  :supporting-libraries 
-                                  *sqlite-supporting-libraries*)
-       (setq *sqlite-library-loaded* t)
-       (warn "Can't load SQLite library ~A" libpath))))
+  (clsql-uffi:find-and-load-foreign-library '("libsqlite" "sqlite")
+                                            :module "sqlite"
+                                            :supporting-libraries *sqlite-supporting-libraries*)
+  (setq *sqlite-library-loaded* t))
 
 (clsql-sys:database-type-load-foreign :sqlite)
 
index 9efaf1f37f80c1708748df8b3f3f06a3c8785724..a3b26b8a42a5cc6726049edca77a09ee6776346c 100644 (file)
@@ -31,16 +31,9 @@ set to the right path before compiling or loading the system.")
   *sqlite3-library-loaded*)
 
 (defmethod database-type-load-foreign ((database-type (eql :sqlite3)))
-  (let ((libpath (uffi:find-foreign-library
-                 '("libsqlite3" "sqlite3")
-                 '(#+64bit "/usr/lib64/"
-                   "/usr/lib/" "/usr/local/lib/" "/bin/")
-                 :drive-letters '("C" "D" "E"))))
-    (if (uffi:load-foreign-library libpath
-                                  :module "sqlite3"
-                                  :supporting-libraries 
-                                  *sqlite3-supporting-libraries*)
-       (setq *sqlite3-library-loaded* t)
-       (warn "Can't load Sqlite3 library ~A" libpath))))
+  (clsql-uffi:find-and-load-foreign-library '("libsqlite3" "sqlite3")
+                                            :module "sqlite3"
+                                            :supporting-libraries *sqlite3-supporting-libraries*)
+  (setq *sqlite3-library-loaded* t))
 
 (clsql-sys:database-type-load-foreign :sqlite3)
index 3abdab6349eafc9781cb05b9e0979436495adba8..015d7a28fea897ae8a98bb82cc6e140c70febccc 100644 (file)
@@ -1,3 +1,9 @@
+cl-sql (3.1.17-1) unstable; urgency=low
+
+  * New upstream
+
+ -- Kevin M. Rosenberg <kmr@debian.org>  Wed, 08 Jun 2005 13:25:06 -0600
+
 cl-sql (3.1.16-1) unstable; urgency=low
 
   * New upstream
index 8b9efb7207601f7c490d0898d73e7dba28125945..05eee3f926be908134b02641d4c8e2b378b3b4b2 100644 (file)
 
 (in-package #:clsql-uffi)
 
-(defvar *clsql-uffi-library-filename* 
-  (uffi:find-foreign-library
-   '(#+(or 64bit x86-64) "uffi64" "uffi")
-   `(,clsql-uffi-system::*library-file-dir*
-     "/usr/lib/clsql/")
-   :drive-letters '("C")))
+(defun find-and-load-foreign-library (filenames &key module supporting-libraries (errorp t))
+  (setq filenames (if (listp filenames) filenames (list filenames)))
+  (or (loop for type in (uffi:foreign-library-types)
+            for suffix = (make-pathname :type type)
+            thereis (loop for filename in filenames
+                          thereis (handler-case
+                                    (uffi:load-foreign-library (merge-pathnames filename suffix)
+                                                               :module module
+                                                               :supporting-libraries supporting-libraries)
+                                    (error (c)
+                                      (warn "~A" c)
+                                      nil))))
+      (when errorp
+        (error "Couldn't load foreign librar~@P ~{~S~^, ~}."
+               (length filenames) filenames))))
+
+(defvar *clsql-uffi-library-filenames*
+    (list #+(or 64bit x86-64) (make-pathname :name "uffi64"
+                                             :directory clsql-uffi-system::*library-file-dir*)
+          #+(or 64bit x86-64) "uffi64"
+          (make-pathname :name "uffi"
+                         :directory clsql-uffi-system::*library-file-dir*)
+          "uffi"))
 
 (defvar *clsql-uffi-supporting-libraries* '("c")
   "Used only by CMU. List of library flags needed to be passed to ld to
@@ -34,15 +51,11 @@ set to the right path before compiling or loading the system.")
   "T if foreign library was able to be loaded successfully")
 
 (defun load-uffi-foreign-library ()
-  (unless (probe-file *clsql-uffi-library-filename*)
-    (error "Unable to find uffi.so"))
-  
-  (if (uffi:load-foreign-library *clsql-uffi-library-filename* 
-                                :module "clsql-uffi" 
-                                :supporting-libraries 
-                                *clsql-uffi-supporting-libraries*)
-      (setq *uffi-library-loaded* t)
-    (error "Unable to load helper library ~A" *clsql-uffi-library-filename*)))
+  (find-and-load-foreign-library *clsql-uffi-library-filenames*
+                                 :module "clsql-uffi" 
+                                 :supporting-libraries 
+                                 *clsql-uffi-supporting-libraries*)
+  (setq *uffi-library-loaded* t))
 
 (load-uffi-foreign-library)
 
index e5837a05f82bac64d9f391423dea50f5843f6d1d..be5abf5379c82feb192ddc69f515afdefdb405be 100644 (file)
@@ -21,6 +21,7 @@
 (defpackage #:clsql-uffi
   (:use #:cl #:uffi)
   (:export
+   #:find-and-load-foreign-library
    #:canonicalize-type-list
    #:convert-raw-field
    #:atoi