ECL now uses dlopen() in OS X so that shared libraries can be loaded.
This commit is contained in:
parent
c9a52b91f4
commit
b34b26b6bf
3 changed files with 29 additions and 13 deletions
|
|
@ -2,11 +2,22 @@
|
|||
Build this module with (compile-file "uffi.lsp")
|
||||
Load it with (load "uffi.fas")
|
||||
|#
|
||||
|
||||
(uffi:load-foreign-library "/usr/lib/libm.dylib")
|
||||
|
||||
;;
|
||||
;; This toplevel statement notifies the compiler that we will
|
||||
;; need this shared library at runtime. We do not need this
|
||||
;; statement in windows.
|
||||
;;
|
||||
#-windows
|
||||
(uffi:load-foreign-library #+darwin "/usr/lib/libm.dylib"
|
||||
#-darwin "/usr/lib/libm.so")
|
||||
;;
|
||||
;; With this other statement, we import the C function sin(),
|
||||
;; which operates on IEEE doubles.
|
||||
;;
|
||||
(uffi:def-function ("sin" c-sin) ((arg :double))
|
||||
:returning :double)
|
||||
|
||||
;;
|
||||
;; We now use this function and compare with the lisp version.
|
||||
;;
|
||||
(format t "~%Lisp sin:~t~d~%C sin:~t~d~%Difference:~t~d"
|
||||
(sin 1.0d0) (c-sin 1.0d0) (- (sin 1.0d0) (c-sin 1.0d0)))
|
||||
|
|
|
|||
|
|
@ -96,6 +96,9 @@ ECL 1.0:
|
|||
|
||||
- DESCRIBE was not prepare for the number range types returned by TYPE-OF.
|
||||
|
||||
- In OS X, ECL can now load shared libraries (Extension *.dylib) thanks
|
||||
to using dlopen() instead of the obsolete NSLinkModule() function.
|
||||
|
||||
* Visible changes:
|
||||
|
||||
- EXT:PROCESS-COMMAND-ARGS now allows for a default rule.
|
||||
|
|
|
|||
20
src/c/load.d
20
src/c/load.d
|
|
@ -19,19 +19,21 @@
|
|||
#include <ecl/internal.h>
|
||||
|
||||
#ifdef ENABLE_DLOPEN
|
||||
# ifdef HAVE_MACH_O_DYLD_H
|
||||
# undef HAVE_DLFCN_H
|
||||
# undef HAVE_LINK_H
|
||||
# include <mach-o/dyld.h>
|
||||
# define INIT_PREFIX "_init_"
|
||||
# ifdef bool
|
||||
# undef bool
|
||||
# endif
|
||||
# endif
|
||||
# ifdef HAVE_DLFCN_H
|
||||
# include <dlfcn.h>
|
||||
# define INIT_PREFIX "init_"
|
||||
# endif
|
||||
# ifdef HAVE_MACH_O_DYLD_H
|
||||
# ifndef HAVE_DLFCN_H
|
||||
# include <mach-o/dyld.h>
|
||||
# define INIT_PREFIX "_init_"
|
||||
# else
|
||||
# undef HAVE_MACH_O_DYLD_H
|
||||
# endif
|
||||
# ifdef bool
|
||||
# undef bool
|
||||
# endif
|
||||
# endif
|
||||
# ifdef HAVE_LINK_H
|
||||
# include <link.h>
|
||||
# endif
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue