Path: utzoo!attcan!uunet!mcvax!unido!laura!exunido!markhof
From: markhof@exunido.uucp (Ingolf Markhof)
Newsgroups: comp.lang.lisp
Subject: Re: Calling C functions from Franz Lisp
Message-ID: <433@laura.UUCP>
Date: 11 Jul 88 13:27:39 GMT
References: <12196@sunybcs.UUCP> <484@aiva.ed.ac.uk> <12363@mimsy.UUCP>
Sender: root@laura.UUCP
Reply-To: markhof@exunido.UUCP (Ingolf Markhof)
Organization: University of Dortmund, W-Germany
Lines: 30


Hi there!

    I'm a member of a group which implemets a floorplanner. We use Franz Lisp,
Flavors, and Yaps. To manage the used/free spaces of the chip area, we use
a corner stitching package written in C. So we have to import some C functions
into Lisp. These C functions return simple values or Lisp lists of integers.

    Now, the problem is that some of the imported C functions do their work
n times, but the Lisp system crashes with the (n+1)th call. By placing
some (msg ...) statements in the Lisp code and by placing some printf
statements in the C code, I found that the error occurs when the flow of
controll reaches the C return statement. The system "hangs up" then. All
you can do is to stop the Lisp job by pressing -Z and then kill it
by the unix kill command. Other - combinations have no effect.

    There is is passage in the paper "The Franz Lisp - C Interface", written
by Fred P. Andresen, wich may be meaningful for our problem. On Page 9 it
says: "7.1 When creating a list in C (...) don't leave any stray lispobjs
lying around which have no other lispobjs pointing to them (C pointers
don't count)."

    But what is exactly the meaning of "C Pointers don't count"? I programmed
the creation of lists in a similar way as it can be seen in the examle on 
page 18 of Andresens paper (lispval lst; lst = newdot (); ...). So, I can't
believe that I did it wrong.

    Ok, I hope this short explanation shows our problem. Can anyone help?

Ingolf Markhof!