From: Dmitry Kalyanov Date: Wed, 11 Nov 2009 20:18:43 +0000 (+0300) Subject: Ensure that foreign libraries are defined and loaded at image startup X-Git-Url: http://repo.macrolet.net/gitweb/?a=commitdiff_plain;h=2871648baa0ee805157c3e815f013f4a378174d0;p=cl-gtk2.git Ensure that foreign libraries are defined and loaded at image startup --- diff --git a/gdk/gdk.package.lisp b/gdk/gdk.package.lisp index 9604c94..dd441c3 100755 --- a/gdk/gdk.package.lisp +++ b/gdk/gdk.package.lisp @@ -5,15 +5,16 @@ (in-package :gdk) -(eval-when (:compile-toplevel :load-toplevel :execute) - (define-foreign-library gdk - (:unix (:or "libgdk-x11-2.0.so.0" "libgdk-x11-2.0.so")) - (:windows "libgdk-win32-2.0-0.dll") - (t "libgdk-2.0")) - (define-foreign-library gdk-pixbuf - (:unix (:or "libgdk_pixbuf-2.0.so.0" "libgdk_pixbuf-2.0.so")) - (:windows (:or "libgdk_pixbuf-win32-2.0-0" "libgdk_pixbuf-2.0-0.dll")) - (t "libgdk_pixbuf-2.0"))) +(glib:at-init () + (eval-when (:compile-toplevel :load-toplevel :execute) + (define-foreign-library gdk + (:unix (:or "libgdk-x11-2.0.so.0" "libgdk-x11-2.0.so")) + (:windows "libgdk-win32-2.0-0.dll") + (t "libgdk-2.0")) + (define-foreign-library gdk-pixbuf + (:unix (:or "libgdk_pixbuf-2.0.so.0" "libgdk_pixbuf-2.0.so")) + (:windows (:or "libgdk_pixbuf-win32-2.0-0" "libgdk_pixbuf-2.0-0.dll")) + (t "libgdk_pixbuf-2.0"))) -(use-foreign-library gdk) -(use-foreign-library gdk-pixbuf) \ No newline at end of file + (use-foreign-library gdk) + (use-foreign-library gdk-pixbuf)) \ No newline at end of file diff --git a/glib/glib.lisp b/glib/glib.lisp index 9fa7dcb..39791f5 100755 --- a/glib/glib.lisp +++ b/glib/glib.lisp @@ -94,21 +94,20 @@ In this example, for every @code{class}, @code{(initialize-gobject-class-g-type (defmacro at-finalize ((&rest keys) &body body) `(register-finalizer (list ,@keys ',body) (lambda () ,@body))) -(eval-when (:compile-toplevel :load-toplevel :execute) - (define-foreign-library glib - (:unix (:or "libglib-2.0.so.0" "libglib-2.0.so")) - (:windows "libglib-2.0-0.dll") - (t (:default "libglib-2.0")))) - -(use-foreign-library glib) - -(eval-when (:compile-toplevel :load-toplevel :execute) - (define-foreign-library gthread - (:unix (:or "libgthread-2.0.so.0" "libgthread-2.0.so")) - (:windows "libgthread-2.0-0.dll") - (t "libgthread-2.0"))) - -(use-foreign-library gthread) +(at-init () + (eval-when (:compile-toplevel :load-toplevel :execute) + (define-foreign-library glib + (:unix (:or "libglib-2.0.so.0" "libglib-2.0.so")) + (:windows "libglib-2.0-0.dll") + (t (:default "libglib-2.0")))) + (eval-when (:compile-toplevel :load-toplevel :execute) + (define-foreign-library gthread + (:unix (:or "libgthread-2.0.so.0" "libgthread-2.0.so")) + (:windows "libgthread-2.0-0.dll") + (t "libgthread-2.0"))) + + (use-foreign-library glib) + (use-foreign-library gthread)) ;; ;; Glib Fundamentals diff --git a/glib/gobject.init.lisp b/glib/gobject.init.lisp index b26470f..9c94cf9 100755 --- a/glib/gobject.init.lisp +++ b/glib/gobject.init.lisp @@ -1,13 +1,14 @@ (defpackage :cl-gtk2-init - (:use :cl)) + (:use :cl :glib)) (in-package :cl-gtk2-init) -(eval-when (:compile-toplevel :load-toplevel :execute) - (cffi:define-foreign-library gobject - (:unix (:or "libgobject-2.0.so.0" "libgobject-2.0.so")) - (:windows "libgobject-2.0-0.dll") - (t "libgobject-2.0"))) +(at-init () + (eval-when (:compile-toplevel :load-toplevel :execute) + (cffi:define-foreign-library gobject + (:unix (:or "libgobject-2.0.so.0" "libgobject-2.0.so")) + (:windows "libgobject-2.0-0.dll") + (t "libgobject-2.0"))) -(cffi:use-foreign-library gobject) + (cffi:use-foreign-library gobject)) diff --git a/gtk-glext/gtkglext.package.lisp b/gtk-glext/gtkglext.package.lisp index 6f870bd..8ce1f75 100755 --- a/gtk-glext/gtkglext.package.lisp +++ b/gtk-glext/gtkglext.package.lisp @@ -8,15 +8,16 @@ (in-package :gtkglext) -(eval-when (:compile-toplevel :load-toplevel :execute) - (define-foreign-library gtkglext - (:unix (:or "libgtkglext-x11-1.0.so.0" "libgtkglext-x11-1.0.so")) - (:windows "libgtkglext-win32-1.0-0.dll") - (t (:default "libgtkglext-1.0"))) - (define-foreign-library gdkglext - (:unix (:or "libgdkglext-x11-1.0.so.0" "libgdkglext-x11-1.0.so")) - (:windows "libgdkglext-win32-1.0-0.dll") - (t (:default "libgdkglext-1.0")))) +(at-init () + (eval-when (:compile-toplevel :load-toplevel :execute) + (define-foreign-library gtkglext + (:unix (:or "libgtkglext-x11-1.0.so.0" "libgtkglext-x11-1.0.so")) + (:windows "libgtkglext-win32-1.0-0.dll") + (t (:default "libgtkglext-1.0"))) + (define-foreign-library gdkglext + (:unix (:or "libgdkglext-x11-1.0.so.0" "libgdkglext-x11-1.0.so")) + (:windows "libgdkglext-win32-1.0-0.dll") + (t (:default "libgdkglext-1.0")))) -(use-foreign-library gtkglext) -(use-foreign-library gdkglext) + (use-foreign-library gtkglext) + (use-foreign-library gdkglext)) diff --git a/gtk/gtk.package.lisp b/gtk/gtk.package.lisp index 61d36fb..287d4ee 100755 --- a/gtk/gtk.package.lisp +++ b/gtk/gtk.package.lisp @@ -32,13 +32,14 @@ (in-package :gtk) -(eval-when (:compile-toplevel :load-toplevel :execute) - (define-foreign-library gtk - (:unix (:or "libgtk-x11-2.0.so.0" "libgtk-x11-2.0.so")) - (:windows (:or "libgtk-2.0-0.dll" "libgtk-win32-2.0-0.dll")) - (t "libgtk-2.0"))) +(at-init () + (eval-when (:compile-toplevel :load-toplevel :execute) + (define-foreign-library gtk + (:unix (:or "libgtk-x11-2.0.so.0" "libgtk-x11-2.0.so")) + (:windows (:or "libgtk-2.0-0.dll" "libgtk-win32-2.0-0.dll")) + (t "libgtk-2.0"))) -(use-foreign-library gtk) + (use-foreign-library gtk)) #+sbcl (when (and (find-package "SB-EXT") (find-symbol "SET-FLOATING-POINT-MODES" (find-package "SB-EXT"))) diff --git a/pango/pango.init.lisp b/pango/pango.init.lisp index 1a88b63..760e3fe 100644 --- a/pango/pango.init.lisp +++ b/pango/pango.init.lisp @@ -1,10 +1,11 @@ (in-package :pango) -(eval-when (:compile-toplevel :load-toplevel :execute) - (define-foreign-library pango - (:unix "libpango-1.0.so.0") - (:windows "libpango-1.0-0.dll") - (t (:default "libgpango-1.0")))) +(glib:at-init () + (eval-when (:compile-toplevel :load-toplevel :execute) + (define-foreign-library pango + (:unix "libpango-1.0.so.0") + (:windows "libpango-1.0-0.dll") + (t (:default "libgpango-1.0")))) -(use-foreign-library pango) + (use-foreign-library pango))