[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Foreign functions from Thin



   Subject:      Foreign functions from Think C
I would like to be able to call foreign functions from MACL (1.3) which are
compiled using Think C rather than MPW.

Question #1: Has anyone done this?

I have played around with this a bit.  My approach is to compile the C program
into a CODE resource file, and then write some LISP code to read this resource
into memory and call it.

Question #2: Does anyone know the format for a CODE resource?

The resulting C code seems to reference global variables as offsets from A4,
but there is no code in the resource which sets up A4.

Question #3: Is accessing globals off A4 a standard Macintosh thing?  Is A4 set
up automagically?  If A4 needs to be set up manually, how does one determine
how much memory to allocate for globals?  Is this information contained in the
CODE resource?

Thanks for any help or pointers,
Erann Gat
gat@robotics.jpl.nasa.gov