Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!think!ames!ptsfa!ihnp4!inuxc!pur-ee!uiucdcs!uiucdcsm!mccaugh From: mccaugh@uiucdcsm.cs.uiuc.edu Newsgroups: comp.lang.c Subject: Re: Lisp-C interface Message-ID: <4700007@uiucdcsm> Date: Wed, 18-Mar-87 02:56:00 EST Article-I.D.: uiucdcsm.4700007 Posted: Wed Mar 18 02:56:00 1987 Date-Received: Sat, 21-Mar-87 07:13:41 EST References: <1067@ius2.cs.cmu.edu> Lines: 32 Nf-ID: #R:ius2.cs.cmu.edu:1067:uiucdcsm:4700007:000:1952 Nf-From: uiucdcsm.cs.uiuc.edu!mccaugh Mar 18 01:56:00 1987 I hesitate to submit this response, since I am unfamiliar with common-lisp and really know only Franz and Xlisp, but what it seems you may need is an un-lisp-like interface between lisp and C: I'm sure you don't wish to re- write the C library to "go after" the mallocs and frees if they are that extensively employed, and you may not have access to the garbage-collector source. Without further info, it is difficult to comment and I wouldn't have butted in here but for the fact your note is almost a week old with no comments to it, so at least the following is better than nothing: If Common Lisp is anything like Franz or Xlisp -- and you wish to hide some data-structures (the C-malloc'd ones, presumably, since you indicate they get free'd by C) from the garbage-collector, don't let those data-structures get to the symbol-table where garbage-collection initiates its sweep. This is just one peon's solution: others involve twiddling with the mark-bits so that even if garbage-collection finds a node it doesn't try to recover it with the right bit set, but the simplest way is to prevent it from accessing your data- structures in the first place. Of course, this crudest of solutions carries with it the onus that if the data- structure doesn't reside in the symbol-table, Lisp never finds it to begin with so other steps need to be taken to ensure Lisp finds it, and that is indeed a problem. If your data-structures aren't parameters, you can't install them on the A-list. However, constants are symbols to Lisp and so enjoy places on the symbol-table. The trick, then, is to find a constant and attach your data-structures to its property-list. The fact that it's constant should prevent garbage-collection from ever trying to recover it, and thus the structures hanging off its prop- erty-list should be safe -- of course, all this presumes ease of their access. -- Scott McCaughrin (mccaugh @ uiucmsl)