r1737: Initial MCL version.
[uffi.git] / src / mcl / libraries.cl
1 ;;;; -*- Mode: LISP; Syntax: ANSI-Common-Lisp; Base: 10; Package: UFFI -*-
2 ;;;; *************************************************************************
3 ;;;; FILE IDENTIFICATION
4 ;;;;
5 ;;;; Name:          libraries.cl
6 ;;;; Purpose:       UFFI source to load foreign libraries
7 ;;;; Programmer:    Kevin M. Rosenberg
8 ;;;; Date Started:  Feb 2002
9 ;;;;
10 ;;;; $Id: libraries.cl,v 1.1 2002/04/04 05:02:03 desoi Exp $
11 ;;;;
12 ;;;; This file, part of UFFI, is Copyright (c) 2002 by Kevin M. Rosenberg
13 ;;;;
14 ;;;; UFFI 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 :uffi)
21
22 (defvar *loaded-libraries* nil
23   "List of foreign libraries loaded. Used to prevent reloading a library")
24
25
26 (defmacro load-foreign-library (filename &key module supporting-libraries)
27   (declare (ignore module supporting-libraries))
28   `(eval-when (:compile-toplevel :load-toplevel :execute)
29      (when (ccl:add-to-shared-library-search-path ,filename t)
30        (pushnew filename *loaded-libraries*))))
31
32 (defun convert-supporting-libraries-to-string (libs)
33   (let (lib-load-list)
34     (dolist (lib libs)
35       (push (format nil "-l~A" lib) lib-load-list))
36     (nreverse lib-load-list)))