-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathload-ndbapi.lisp
More file actions
39 lines (26 loc) · 1.32 KB
/
load-ndbapi.lisp
File metadata and controls
39 lines (26 loc) · 1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
;;; Copyright (c) 2022 Max-Gerd Retzlaff <mgr@matroid.org>, Datagraph GmbH.
;;; Distributed under the terms of the GNU General Public License, Version 2.0,
;;; see file LICENSE in the top level directory of this repository.
(in-package :ndbapi.implementation)
;; libndbapi / libndbclient library
(cffi:define-foreign-library :libndbapi
(:unix (:or "libndbclient.so" "libndbclient.so.6.1.0"))
(t (:default "libndbclient")))
;; ndbapi wrapper library
(cffi:define-foreign-library :ndbapi-wrap
(:unix (:or "ndbapi_wrap.so"))
(t (:default "ndbapi_wrap")))
;; load ndbapi libraries
(defvar *ndbapi-loaded* nil)
;; The ndbapi_wrap.so library will be created in the ndbapi directory
;; and I also put a link to "libndbclient.so.6.1.0" there so that that
;; library is found easily as well. The library can be found via:
;; (asdf:system-source-directory (asdf:find-system :ndbapi))
(defun load-ndbapi (&key search-path)
(unless *ndbapi-loaded*
(let ((search-path (or search-path (asdf:system-source-directory (asdf:find-system :ndbapi)))))
(cffi:load-foreign-library :libndbapi :search-path search-path)
(cffi:load-foreign-library :ndbapi-wrap :search-path search-path))
(setf *ndbapi-loaded* t)))
;; to ensure early loading, you could add to your image:
;; #+sbcl(pushnew 'load-ndbapi sb-ext:*init-hooks*)