Hello Peng,
> I am looking for documentation or examples that tell how to write
> extensions to MAXIMA using Lisp and C. In addition, I wish to see
> the C extension part can be dynamically linked (or loaded).
> Ideally, I wish that Maxima function can directly call C functions
> through dynamic loading, or call through Lisp glue.
> Can anyone point a direction? Many thanks.
About C extensions: (1) Direct linking via FFI. Each Lisp variety
has its own FFI. There have been attempts (CFFI, UFFI, Hello-C)
to construct a generic FFI. I don't know which of those has been
most successful. Take a look at this: http://common-lisp.net/project/cffi/
and tell us what you think.
(2) Talk to a C program through a socket. This is what some GUI's do.
This is somewhat involved, I'm afraid. See maxima/src/server.lisp .
About Lisp extensions: the simplest thing is just (defun $my_function ...).
There are various degrees of difficulty involved in more complex stuff.
See "Lisp and Maxima" in
http://maxima.sourceforge.net/docs/tutorial/en/minimal-maxima.pdf
for a 25-words-or-less introduction. See also:
http://maxima.sourceforge.net/wiki/index.php/Maxima%20internals
Peng, if you figure out the FFI stuff, especially if it's one of the portable
ones, I'd be really, really interested to hear about it!
hope this helps,
Robert Dodier