r9569: `head -6 ChangeLog`
[clsql.git] / uffi / clsql-uffi-loader.lisp
1 ;;;; -*- Mode: LISP; Syntax: ANSI-Common-Lisp; Base: 10 -*-
2 ;;;; *************************************************************************
3 ;;;; FILE IDENTIFICATION
4 ;;;;
5 ;;;; Name:     clsql-uffi-loader.sql
6 ;;;; Purpose:  Library loader using CLSQL UFFI helper library
7 ;;;; Author:   Kevin M. Rosenberg
8 ;;;; Created:  Mar 2002
9 ;;;;
10 ;;;; $Id$
11 ;;;;
12 ;;;; This file, part of CLSQL, is Copyright (c) 2002-2004 by Kevin M. Rosenberg
13 ;;;;
14 ;;;; CLSQL users are granted the rights to distribute and use this software
15 ;;;; as governed by the terms of the Lisp Lesser GNU Public License
16 ;;;; (http://opensource.franz.com/preamble.html), also known as the LLGPL.
17 ;;;; *************************************************************************
18
19 (in-package #:clsql-uffi)
20
21 (defvar *clsql-uffi-library-filename* 
22   (uffi:find-foreign-library
23    "uffi"
24    `(,clsql-uffi-system::*library-file-dir*
25      "/usr/lib/clsql/")
26    :drive-letters '("C")))
27
28 (defvar *clsql-uffi-supporting-libraries* '("c")
29   "Used only by CMU. List of library flags needed to be passed to ld to
30 load the MySQL client library succesfully.  If this differs at your site,
31 set to the right path before compiling or loading the system.")
32
33 (defvar *uffi-library-loaded* nil
34   "T if foreign library was able to be loaded successfully")
35
36 (defun load-uffi-foreign-library ()
37   (unless (probe-file *clsql-uffi-library-filename*)
38     (error "Unable to find uffi.so"))
39   
40   (if (uffi:load-foreign-library *clsql-uffi-library-filename* 
41                                  :module "clsql-uffi" 
42                                  :supporting-libraries 
43                                  *clsql-uffi-supporting-libraries*)
44       (setq *uffi-library-loaded* t)
45     (error "Unable to load helper library ~A" *clsql-uffi-library-filename*)))
46
47 (load-uffi-foreign-library)
48