0af49ccd5b5e37d9a5b030b955b542f5634f4d0e
[clsql.git] / db-oracle / oracle-loader.lisp
1 ;;;; -*- Mode: LISP; Syntax: ANSI-Common-Lisp; Base: 10 -*-
2 ;;;; *************************************************************************
3 ;;;; FILE IDENTIFICATION
4 ;;;;
5 ;;;; Name:          oracle-loader.lisp
6 ;;;; Purpose:       Foreign library loader for CLSQL Oracle interface
7 ;;;;
8 ;;;; $Id$
9 ;;;;
10 ;;;; This file is part of CLSQL.
11 ;;;;
12 ;;;; CLSQL users are granted the rights to distribute and use this software
13 ;;;; as governed by the terms of the Lisp Lesser GNU Public License
14 ;;;; (http://opensource.franz.com/preamble.html), also known as the LLGPL.
15 ;;;; *************************************************************************
16
17 (in-package #:clsql-oracle)
18
19 (defparameter *clsql-oracle-library-path* 
20   (uffi:find-foreign-library
21    "oracle"
22    `(,(make-pathname :directory (pathname-directory *load-truename*))
23      "/9i/lib/"
24      "/usr/lib/clsql/"
25      "/sw/lib/clsql/"
26      "/home/kevin/debian/src/clsql/db-oracle/")
27    :drive-letters '("C")))
28
29 (defvar *oracle-library-candidate-drive-letters* '("C" "D" "E"))
30
31 (defvar *oracle-supporting-libraries* '("c")
32   "Used only by CMU. List of library flags needed to be passed to ld to
33 load the Oracle client library succesfully.  If this differs at your site,
34 set to the right path before compiling or loading the system.")
35
36 (defvar *oracle-library-loaded* nil
37   "T if foreign library was able to be loaded successfully")
38
39 (defmethod clsql-sys:database-type-library-loaded ((database-type (eql :oracle)))
40   *oracle-library-loaded*)
41                                       
42 (defmethod clsql-sys:database-type-load-foreign ((database-type (eql :oracle)))
43   (uffi:load-foreign-library *clsql-oracle-library-path* 
44                              :module "clsql-oracle" 
45                              :supporting-libraries *oracle-supporting-libraries*)
46   (setq *oracle-library-loaded* t))
47
48
49 (clsql-sys:database-type-load-foreign :oracle)
50
51