On Saturday, April 20, 2024 at 12:48:43 PM UTC+1 Waldek Hebisch wrote:
On Sat, Apr 20, 2024 at 02:47:02AM -0700, Dima Pasechnik wrote: > How does one do this? > (with ECL or SBCL). > > Presumably if one makes a FriCAS fasl library (how?), it should be possible > to call FriCAS functions from Lisp without going through files or pipes. > > That's certainly possible (and used in Sage) with Maxima. Look at 'contrib/load-fricas.lisp' and 'contrib/mk_shlib.lisp'. 'contrib/mk_shlib.lisp' makes ECL .fas (really a C shared library). Currently 'contrib/load-fricas.lisp' is broken with sbcl, one needs to add an extra line loading GMP support (I will fix this shortly, after more testing). in sbcl build, /full_path_to_FriCAS_build_directory/src/interp/ has no src/interp/ - so this seems to be broken too. Or probably there is a confusion of terms, as there is a build directory, build/x86_64-linux-gnu/, containing bin/ and lib/, but no src/ It should be very easy to convert this file into a template (.in) that is filled in by ./configure with the correct values. Anyhow, if instead I use the location of the source directory, with src/interp present, I get "Package C does not exist." error. $ sbcl <mk_shlib.lisp This is SBCL 2.4.3, an implementation of ANSI Common Lisp. More information about SBCL is available at <http://www.sbcl.org/>. SBCL is free software, provided as is, with absolutely no warranty. It is mostly in the public domain; some portions are provided under BSD-style licenses. See the CREDITS and COPYING files in the distribution for more information. * FOO * FOO NIL NIL * ; file: /mnt/opt/fricas/src/interp/../lisp/fricas-package.lisp ; in: DEFMACRO IN-PACKAGE ; (DEFMACRO FRICAS-LISP::IN-PACKAGE (PACKAGE &REST FRICAS-LISP::OPTIONS) ; `(IN-PACKAGE ,PACKAGE)) ; --> SB-INT:NAMED-DS-BIND SB-INT:BINDING* ; ==> ; (LET* ((#:G0 ; (SB-C::CHECK-DS-LIST/&REST (CDR #:EXPR) 1 1 ; '(# PACKAGE &REST FRICAS-LISP::OPTIONS))) ; (PACKAGE (POP #:G0)) ; (FRICAS-LISP::OPTIONS #:G0)) ; (DECLARE (SB-C::CONSTANT-VALUE PACKAGE FRICAS-LISP::OPTIONS)) ; (BLOCK FRICAS-LISP::IN-PACKAGE `(IN-PACKAGE ,PACKAGE))) ; ; caught STYLE-WARNING: ; The variable OPTIONS is defined but never used. ; ; compilation unit finished ; caught 1 STYLE-WARNING condition T * debugger invoked on a SB-INT:SIMPLE-READER-PACKAGE-ERROR in thread #<THREAD tid=29834 "main thread" RUNNING {10042A80A3}>: Package C does not exist. Line: 29, Column: 23, File-Position: 848 Stream: #<SYNONYM-STREAM :SYMBOL SB-SYS:*STDIN* {10000208B3}> Type HELP for debugger help, or (SB-EXT:EXIT) to exit from SBCL. restarts (invokable by number or by possibly-abbreviated name): 0: [CONTINUE ] Use the current package, COMMON-LISP-USER. 1: [RETRY ] Retry finding the package. 2: [USE-VALUE] Specify a different package 3: [UNINTERN ] Read the symbol as uninterned. 4: [SYMBOL ] Specify a symbol to return 5: [ABORT ] Exit debugger, returning to top level. (SB-IMPL::READER-FIND-PACKAGE "C" #<SYNONYM-STREAM :SYMBOL SB-SYS:*STDIN* {10000208B3}> T) 0] Dima In both cases usage has changed a bit: one needs to set FRICAS environment variable to location of build tree. Both files contain instructions about use. -- Waldek Hebisch -- You received this message because you are subscribed to the Google Groups "FriCAS - computer algebra system" group. To unsubscribe from this group and stop receiving emails from it, send an email to fricas-devel+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/fricas-devel/8705732a-8fc6-4f50-a680-e83f5911dd11n%40googlegroups.com.