[cffi-devel] Re: cffi not working on x86-64 with cmucl (working with sbcl)

Luís Oliveira luismbo at gmail.com
Fri Mar 24 13:26:40 UTC 2006


Dawgmatix <dawgmatix at gmail.com> writes:
> Lisp: CMUCL version 19c OS
...
> today I tried loading cl-opengl as well as load libGL.so manually. It
> does not work.

Can you try the following patch?

diff -rN -u cffi-old/src/cffi-cmucl.lisp cffi-new/src/cffi-cmucl.lisp
--- cffi-old/src/cffi-cmucl.lisp        2006-03-16 10:47:23.000000000 +0000
+++ cffi-new/src/cffi-cmucl.lisp        2006-03-24 13:14:40.000000000 +0000
@@ -320,6 +320,10 @@
 
 ;;;# Loading and Closing Foreign Libraries
 
+;;; Work-around for compiling ffi code without loading the
+;;; respective library at compile-time.
+(setf c::top-level-lambda-max 0)
+
 (defun %load-foreign-library (name)
   "Load the foreign library NAME."
   (sys::load-object-file name))
diff -rN -u cffi-old/src/libraries.lisp cffi-new/src/libraries.lisp
--- cffi-old/src/libraries.lisp 2006-02-23 02:21:13.000000000 +0000
+++ cffi-new/src/libraries.lisp 2006-03-24 13:14:59.000000000 +0000
@@ -113,9 +113,8 @@
 (defmacro define-foreign-library (name &body pairs)
   "Defines a foreign library NAME that can be posteriorly used with
 the USE-FOREIGN-LIBRARY macro."
-  `(eval-when (#+(or cmu scl) :compile-toplevel :load-toplevel :execute)
-     (setf (get-foreign-library ',name) ',pairs)
-     ',name))
+  `(progn (setf (get-foreign-library ',name) ',pairs)
+          ',name))
 
 (defun cffi-feature-p (feature-expression)
   "Matches a FEATURE-EXPRESSION against the symbols in *FEATURES*
@@ -243,8 +242,7 @@
        (:or (try-foreign-library-alternatives (rest library)))))))
 
 (defmacro use-foreign-library (name)
-  `(eval-when (:load-toplevel :execute #+(or cmu scl) :compile-toplevel)
-     (load-foreign-library ',name)))
+  `(load-foreign-library ',name))
 
 ;;;# Closing Foreign Libraries
 ;;;



Thanks.

-- 
Luís Oliveira
luismbo (@) gmail (.) com
Equipa Portuguesa do Translation Project
http://www.iro.umontreal.ca/translation/registry.cgi?team=pt




More information about the cffi-devel mailing list