2 (in-package :gcc-xml-test
)
5 (loop for d
= (read s nil
)
10 (defparameter *library-path
*
11 (asdf:component-pathname
13 (asdf:find-system
"gcc-xml-ffi-test")
16 (defun uffi-load-library (lib)
17 (unless (uffi:load-foreign-library
18 (uffi:find-foreign-library
20 (list (pathname-directory *load-truename
*)
21 (print (merge-pathnames
22 (make-pathname :directory
(list :relative
"libffitest" ".libs"))
25 (print (merge-pathnames
26 (make-pathname :directory
(list :relative
"lib" "ffitest"))
29 :types
'("so" "dylib"))
30 :supporting-libraries
'("c")
33 (error "Unable to load ffitest library")))
35 (eval-when (:compile-toplevel
:load-toplevel
:execute
)
36 (defparameter *ffitest-loaded
* nil
)
39 (uffi-load-library "libffitest"))
41 (with-open-file (defout "decls.lisp" :direction
:output
:if-exists
:supersede
)
42 (setf decls
(parse-gcc-xml-file "test/ffitest.xml"))
43 (write-uffi-declarations decls defout
))
44 (with-open-file (defin "decls.lisp" :direction
:input
)
45 (let ((*package
* (find-package :gcc-xml-test
)))
47 (setf *ffitest-loaded
* t
)
51 (let ((x (uffi::convert-to-foreign-string
"evenboguser")))
52 (let ((foreign-string-y (|foo_function| x
)))
53 (let ((y (uffi::convert-from-foreign-string foreign-string-y
)))
55 (uffi:free-foreign-object foreign-string-y
))
56 (uffi:free-foreign-object x
)))
58 (defun do-uffi-test-2 ()
60 (uffi-load-library "libffitest"))
62 (with-open-file (defout "decls.lisp" :direction
:output
:if-exists
:supersede
)
63 (setf decls
(parse-gcc-xml-file "test/ffitest2.xml"))
64 (write-uffi-declarations decls defout
)
66 ; (defpackage #:opengl (:use #:cl))
67 ; (let ((*package* (find-package :opengl)))
68 (let ((*package
* (find-package :gcc-xml-test
)))
69 (with-open-file (defin "decls.lisp" :direction
:input
)