dabe5c9df019627c87d35f26d63c81e35426056e
[clsql.git] / clsql-uffi / clsql-uffi-loader.cl
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 ;;;; Programmers:   Kevin M. Rosenberg
8 ;;;; Date Started:  Mar 2002
9 ;;;;
10 ;;;; $Id: clsql-uffi-loader.cl,v 1.2 2002/08/01 21:39:22 kevin Exp $
11 ;;;;
12 ;;;; This file, part of CLSQL, is Copyright (c) 2002 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 (declaim (optimize (debug 3) (speed 3) (safety 1) (compilation-speed 0)))
20 (in-package :clsql-uffi)
21
22 (defvar *clsql-uffi-library-filename* 
23   (uffi:find-foreign-library
24    "clsql-uffi"
25    `(,(directory-namestring
26        (translate-logical-pathname 
27         "cl-library:clsql-uffi;"))
28      "/usr/lib/clsql/")
29    :drive-letters '("C" "D" "E" "F" "G")))
30
31 (defvar *clsql-uffi-supporting-libraries* '("c")
32   "Used only by CMU. List of library flags needed to be passed to ld to
33 load the MySQL client library succesfully.  If this differs at your site,
34 set to the right path before compiling or loading the system.")
35
36 (defvar *uffi-library-loaded* nil
37   "T if foreign library was able to be loaded successfully")
38
39 (defun load-uffi-foreign-library ()
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     (warn "Unable to load helper library ~A" *clsql-uffi-library-filename*)))
46
47 (load-uffi-foreign-library)
48
49
50