Subject: [clisp-list] problem with update_library in foreign.d

From: "Roland Averkamp" <[email-masked]>
Date: Sun Sep 28 10:11:04 2003

Hello,
I think there is a bug in the function update_library in defined in file
foreign.d:
At the end of the while loop one has to insert

lib_list = Cdr(lib_list);

otherwise this function(namely the wile loop) does not terminate. 

Right now if a foreign function is defined with the (:library ...) clause
and then an image is saved,
calling the foreign function function in a session with this saved image
does not terminate, 
since update_library is called for the library.
bye,
Roland

have a look:

/* update the DLL pointer and all related objects
 acons = (library fpointer object1 object2 ...) */
local void update_library (object acons, uintL version) {
  var object lib_name = Car(acons);
  var object lib_addr = Car(Cdr(acons)); /* presumably invalid */
  var void *lib_handle = open_library(lib_name,version);
  TheFpointer(lib_addr)->fp_pointer = lib_handle;
  mark_fp_valid(TheFpointer(lib_addr));
 #if !defined(AMIGAOS)
  var object lib_list = Cdr(Cdr(acons));
  while (consp(lib_list)) {
    var object fo = Car(lib_list); /* foreign object */
    var object fa = foreign_address(fo,false); /* its foreign address */
    var gcv_object_t *fn;                       /* its name */
    switch (Record_type(fo)) {
      case Rectype_Fvariable: fn = &(TheFvariable(fo)->fv_name); break;
      case Rectype_Ffunction: fn = &(TheFfunction(fo)->ff_name); break;
      default: NOTREACHED;
    }
    ASSERT(eq(TheFaddress(fa)->fa_base,lib_addr));
    TheFaddress(fa)->fa_offset = (sintP)object_handle(acons,fn,false) -
      (sintP)lib_handle;
  }
 #endif
}

-- 
NEU FÜR ALLE - GMX MediaCenter - für Fotos, Musik, Dateien...
Fotoalbum, File Sharing, MMS, Multimedia-Gruß, GMX FotoService

Jetzt kostenlos anmelden unter http://www.gmx.net

+++ GMX - die erste Adresse für Mail, Message, More! +++

---

From: Sam Steingold <[email-masked]>
Date: Mon Sep 29 08:39:17 2003

> * Roland Averkamp <[email-masked]> [2003-09-28 19:09:35 +0200]:
>
> I think there is a bug in the function update_library in defined in
> file foreign.d:

thanks, fixed in the CVS.

-- 
Sam Steingold (http://www.podval.org/~sds) running w2k
<http://www.camera.org> <http://www.iris.org.il> <http://www.memri.org/>
<http://www.mideasttruth.com/> <http://www.honestreporting.com>
Lisp is a language for doing what you've been told is impossible. - Kent Pitman