Thanks!!! It worked like a charm!

Below are some remarks.

On Thu, 18 Sep 2003 10:07:48 +0200, Eric Marsden <[EMAIL PROTECTED]> wrote:

> if your foreign library is a DSO (a .so file that can be handled by
> dlopen),

I'm afraid my C knowledge is not deep enough to understand this
fully. I've built my libraries with

  gcc -fPIC -c cl-gd-glue.c
  ld -lgd -lz -lpng -ljpeg -lfreetype -lm -liconv -shared cl-gd-glue.o -o cl-gd-glue.so

Are the -fPIC and -shared flags sufficient to create a DSO (on Linux)
or was I just lucky?

> and you use SYS::LOAD-OBJECT-FILE to load it instead of
> EXT:LOAD-FOREIGN,

I had used UFFI's LOAD-FOREIGN-LIBRARY and it did the Right Thing(TM).

> you can try the following:
>   
> (defun reload-global-table ()
>   (loop :for lib-entry in sys::*global-table*
>       :for (sap . lib-path) = lib-entry
>         :when lib-path :do
>         (let ((new-sap (sys::dlopen (namestring lib-path)
>                                     (logior sys::rtld-now sys::rtld-global))))
>           (when (zerop (sys:sap-int new-sap))
>             (error "Couldn't open library ~S: ~S" lib-path (sys::dlerror)))
>           (setf (car lib-entry) new-sap)))
>   (alien:alien-funcall (alien:extern-alien "os_resolve_data_linkage"
>                                          (alien:function c-call:void))))
> 
> (compile 'reload-global-table)
> 
> (pushnew 'reload-global-table ext:*after-save-initializations*)

I think this should be added to the "Tips and Tricks" section of

  <http://www.cons.org/cmucl/doc/index.html>.

Maybe just a link to Gmane version of your email.

One last note. I had built my core with

  (ext:save-lisp "survey.core"
                 :init-function 'survey::create-result-page
                 :print-herald nil
                 :load-init-file nil
                 :site-init nil
                 :batch-mode t)

My 'main' function SURVEY::CREATE-RESULT-PAGE happened to return an
arbitrary string on success but it looks like in batch mode it must
return 0 in order to feed UNIX:UNIX-EXIT. Otherwise I get

  [EMAIL PROTECTED]:~/survey > lisp -core survey.core

  Type-error in KERNEL::OBJECT-NOT-TYPE-ERROR-HANDLER:
     "</body></html>" is not of type (SIGNED-BYTE 32)


  Debug  (type H for help)

  (UNIX:UNIX-EXIT 1 "</body></html>")[:EXTERNAL]

Is that documented somewhere? Couldn't find it.

And why does it look like UNIX:UNIX-EXIT accepts two arguments in the
debugger output above? The docstring says it only take one (optional)
argument.

Thanks again for your help,
Edi.

Reply via email to