[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Foreign functions from Thin
- To: Gat <Gat@ai.jpl.nasa.gov>
- Subject: Re: Foreign functions from Thin
- From: moon (David A. Moon)
- Date: Wed, 22 May 91 11:24:00
- Cc: email@example.com
> Date: 21 May 91 14:31:22
> From: Gat <Gat@ai.jpl.nasa.gov>
> I would like to be able to call foreign functions from MACL (1.3) which are
> compiled using Think C rather than MPW.
> 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.
As I recall from when I used Think C, everything about CODE resources is in
fact documented in the Think C manual. I think if you look carefully you'll
find code to set A4 at the front of the resource, and an explanation in the
manual of why it uses A4 where it would normally use A5. If I recall correctly
space for the globals is right in the resource.