From: Steve Rooke
Subject: Calling C from AKCL on SGI/IRIX 4.0.5
Date: 
Message-ID: <1993Feb5.160617.16243@noao.edu>
Has anyone succeeded in calling C routines from AKCL Lisp running on an
SGI workstation running IRIX 4.0.x?

I have AKCL 6.15 running on an SGI R3K Indigo at IRIX 4.0.5.  I have tried
both the fast-link method and linking the C object file into saved_kcl
itself.  For si::faslink it was necessary to recompile all of akcl with
cc -G 0 rather than the default -G 8, since ld -A requires -G 0.  In both
cases I get a core dump ('20206 Illegal instruction' if faslink, 
'Error: Caught fatal error [memory may be damaged]' if hard linked)
whenever I reference the lisp interface to the C function.

I have read the example in akcl/lsp/littleXlsp.{lsp|c}, in which case the
.c file appears to have been generated by (compile-file "littleXlsp.lsp"),
and tried similar approaches to no avail.  But from the akcl documentation
on defentry and the like it would appear all that is necessary on the lisp
side is (defentry c-test (int) (int "c_test")), and in the .c file, for
a trivial test:

    int c_test (int int1) { return (int1); }

This links in fine with either si::faslink or hard link, but dies upon
reference.  Examining saved_kcl with dbx reveals a nil value of 
cf->cf.cf_self at some point, as though the actual entry point in saved_kcl
address space is not being determined or stored.

Alternatively, does anyone have code for akcl/c/rel_sgi4d.c (a different
means of fast-loading existing object files than ld -A)?

Or should I be using a different ftp-able Lisp?  All the commercial Lisps
I can find for the SGI that allow foreign function calls cost around $2000.

-- 
Steve Rooke  (Internet:  ·····@noao.edu  or UUCP:  uunet!noao.edu!rooke)