From 5e99481bd334bc55a9be760a550687e2a7f03646 Mon Sep 17 00:00:00 2001 From: Dima Pasechnik Date: Wed, 9 Jun 2021 10:49:09 +0000 Subject: [PATCH 1/2] modern macOS does not need libm.dylib, nor has it --- src/doc/manual/extensions/ffi.txi | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/doc/manual/extensions/ffi.txi b/src/doc/manual/extensions/ffi.txi index 72386b7dd..d10fabcdc 100644 --- a/src/doc/manual/extensions/ffi.txi +++ b/src/doc/manual/extensions/ffi.txi @@ -221,11 +221,11 @@ Build and load this module with (compile-file "uffi.lsp" :load t) ;; ;; This toplevel statement notifies the compiler that we will ;; need this shared library at runtime. We do not need this -;; statement in windows. +;; statement in windows or modern macOS. +;; The actually needed path to libm might be different on different systems. ;; -#-(or ming32 windows) -(ffi:load-foreign-library #+darwin "/usr/lib/libm.dylib" - #-darwin "/usr/lib/libm.so") +#-(or ming32 windows darwin) +(ffi:load-foreign-library "/usr/lib/libm.so") ;; ;; With this other statement, we import the C function sin(), ;; which operates on IEEE doubles. -- GitLab From a58106e207b23a7e0e6b3f2ea2d3ed89e18e2c59 Mon Sep 17 00:00:00 2001 From: Dima Pasechnik Date: Thu, 10 Jun 2021 14:33:08 +0100 Subject: [PATCH 2/2] more details added, and examples adjusted --- examples/ffi/cffi.lsp | 7 +++---- examples/ffi/uffi.lsp | 7 +++---- src/doc/manual/extensions/ffi.txi | 10 ++++++---- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/examples/ffi/cffi.lsp b/examples/ffi/cffi.lsp index e6924d15d..8eb63d71a 100644 --- a/examples/ffi/cffi.lsp +++ b/examples/ffi/cffi.lsp @@ -4,11 +4,10 @@ Build and load this module with (compile-file "cffi.lsp" :load t) ;; ;; This toplevel statement notifies the compiler that we will ;; need this shared library at runtime. We do not need this -;; statement in windows. +;; statement in windows or macOS. ;; -#-(or ming32 windows) -(cffi:load-foreign-library #+darwin "/usr/lib/libm.dylib" - #-darwin "/usr/lib/libm.so") +#-(or ming32 windows darwin) +(cffi:load-foreign-library "/usr/lib/libm.so") ;; ;; With this other statement, we import the C function sin(), ;; which operates on IEEE doubles. diff --git a/examples/ffi/uffi.lsp b/examples/ffi/uffi.lsp index a5d99b232..960a12900 100644 --- a/examples/ffi/uffi.lsp +++ b/examples/ffi/uffi.lsp @@ -5,11 +5,10 @@ Load it with (load "uffi.fas") ;; ;; This toplevel statement notifies the compiler that we will ;; need this shared library at runtime. We do not need this -;; statement in windows. +;; statement in windows and macOS. ;; -#-windows -(uffi:load-foreign-library #+darwin "/usr/lib/libm.dylib" - #-darwin "/usr/lib/libm.so") +#-(or windows darwin) +(uffi:load-foreign-library "/lib64/libm.so.6") ;; adjust the library path/name as needed ;; ;; With this other statement, we import the C function sin(), ;; which operates on IEEE doubles. diff --git a/src/doc/manual/extensions/ffi.txi b/src/doc/manual/extensions/ffi.txi index d10fabcdc..db1e0ae20 100644 --- a/src/doc/manual/extensions/ffi.txi +++ b/src/doc/manual/extensions/ffi.txi @@ -212,6 +212,9 @@ that the compiler may include them at link time. @item Every function you will use has to be declared using @coderef{ffi:def-function}. +@item +In the cases of headers not used by ECL, a header to include might need +to be specified using @coderef{ffi:clines}. @end itemize @lisp @@ -257,11 +260,10 @@ Build and load this module with (compile-file "cffi.lsp" :load t) ;; ;; This toplevel statement notifies the compiler that we will ;; need this shared library at runtime. We do not need this -;; statement in windows. +;; statement in windows or macOS. ;; -#-(or ming32 windows) -(cffi:load-foreign-library #+darwin "/usr/lib/libm.dylib" - #-darwin "/usr/lib/libm.so") +#-(or ming32 windows darwin) +(cffi:load-foreign-library "/usr/lib/libm.so") ;; ;; With this other statement, we import the C function sin(), ;; which operates on IEEE doubles. -- GitLab