Remove old windows .dll files from source
[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 ;;;; This file is part of CLSQL.
9 ;;;;
10 ;;;; CLSQL users are granted the rights to distribute and use this software
11 ;;;; as governed by the terms of the Lisp Lesser GNU Public License
12 ;;;; (http://opensource.franz.com/preamble.html), also known as the LLGPL.
13 ;;;; *************************************************************************
14
15 (in-package #:clsql-oracle)
16
17 (defparameter *oracle-home*
18   (let ((oracle-home (getenv "ORACLE_HOME")))
19     (when oracle-home
20       (parse-namestring (concatenate 'string oracle-home "/"))))
21   "Pathname of ORACLE_HOME as set in user environment.")
22
23 (defparameter *oracle-client-library-filenames*
24   (list "libclntsh" "oci"))
25
26 (defvar *oracle-supporting-libraries* '("c")
27   "Used only by CMU. List of library flags needed to be passed to ld to
28 load the Oracle client library succesfully.  If this differs at your site,
29 set to the right path before compiling or loading the system.")
30
31 (defvar *oracle-library-loaded* nil
32   "T if foreign library was able to be loaded successfully")
33
34 (defmethod clsql-sys:database-type-library-loaded ((database-type (eql :oracle)))
35   *oracle-library-loaded*)
36
37 (defmethod clsql-sys:database-type-load-foreign ((database-type (eql :oracle)))
38   (when *oracle-home*
39     (dolist (dir-name '("lib" "bin"))
40       (dolist (lib-name '("libclntsh" "oci"))
41         (clsql:push-library-path
42          (make-pathname :name lib-name
43                         :directory (append (pathname-directory *oracle-home*)
44                                            (list dir-name)))))))
45
46   (clsql-uffi:find-and-load-foreign-library *oracle-client-library-filenames*
47                                             :module "clsql-oracle"
48                                             :supporting-libraries *oracle-supporting-libraries*)
49   (setq *oracle-library-loaded* t))
50
51 (clsql-sys:database-type-load-foreign :oracle)
52
53