On Sat, Dec 12, 2020 at 11:58:35AM -0800, Tobias wrote:
> Hello!
> 
> I am interested in using a FriCAS (DoubleFloat -> DoubleFloat) function 
> from C.
> Is such a thing easily (out of the box) possible, or has anyone explored 
> that before? Presumably it could be done, at least in principle, see 
> http://www.sbcl.org/manual/index.html#Calling-Lisp-From-C but it's likely 
> difficult and hacky.

There are no ready example.  As Dima mentioned, probably easiest
way is to use ECL to compile FriCAS.  ECL has good support for
calling Lisp from C.  Then you need to bridge differences
between Lisp and FriCAS: not all Lisp data makes sense for
FriCAS and most FriCAS data is only indirectly exposed to
Lisp.  For calling FriCAS from Lisp there is an example,
look at file 'contrib/load-fricas.lisp' in FriCAS sources.

In principle sbcl supports calling Lisp from C, but I am
not sure how easy/conenient it is.
 
> While I could launch a new FriCAS and parse the output for each call, this 
> would be too inefficient for my application. An alternative would be to run 
> FriCAS once and stream
> input and output for many function calls (as probably SageMath and others 
> do it). Ideally I want to have as little overhead as possible.
> 
> I would be happy for any suggestions in that regard!

I would suggest starting from connection via pipe.  Any call
between C and FriCAS must convert data.  Converting say C
format to communication format, sending this via pipe and
then converting to FriCAS format is less efficient than
more direct convertion but is easier to implement and
may be fast enough.  I wrote above "communication format"
because easy way uses text, but one could also use
binary format.


-- 
                              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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/fricas-devel/20201212230935.GA17579%40math.uni.wroc.pl.

Reply via email to