Subject: [clisp-list] Image libraries and dynamic foreign functions

From: "Hoehle, Joerg-Cyril" <[email-masked]>
Date: Thu Apr 18 00:22:02 2002

Hi,

Scott Williams wrote:
> In light of the new dynamically loadable foreign function 
> interface, is it
> still best to make an interface to ImageMagick a standard 
> module (like regexp) that is part of a memory image?

It depends. In my article (sent separately) on extending CLISP via modules, I don't give much advice on this topic. The final decision is up to you.

o If you already have an interface to ImageMagick based on a CLISP module, why change it?

o If you're considering a future interface to ImageMagick, a dynamic FFI might be more appealing (as it's more likely to be portable to other Lisp implementations, or ported from other ones). However, the FFI approach has certain drawbacks that I highlight in my article.

The most important one is possibly the lack of integration with Lisp, i.e. all you have is chars, ints and arrays of those.
For instance, Dan Stanger preferred to write his GDI based on modules. He manipulates Lisp arrays directly, which you cannot do with the FFI. Maybe he wants to comment on his choices. I don't know whether he expects better performance or more comfort or better integration into the Lisp world (i.e. feel less "foreign") from doing so.

Sam Steingold wrote:
>it will be very easy to convert to the DLL FFI (when/if it arrives)
Even if I were to die (or be overwhelmed with other stuff), I think I already released enough information to let CLISP users fly alone.

Regards,
	Jorg Hohle.

---

From: Dan Stanger <[email-masked]>
Date: Thu Apr 18 07:37:03 2002

There were a few reasons that I created the module in c.
1) I was starting with a c header file, and I remembered the simple awk compiler in the awk book.
It has saved be a few times.  It was really easy to generate c code from the headers.
2) I am not familiar with gdi at all, so I wanted to be able to use gdb to examine c variables,
to confirm the values I was passing in to the gdi functions.
3) I thought that if I generated the code properly, there would be less debugging.
4) This module is specific to 2 enviroments, ms windows and react os.

The module I generated was about 8k lines of code.  I had to hand modify about 300
lines of it.  In retrospect, I would have tried to refer to variables on the stack instead
of popping them, then at the end, pop them all at once.  Also my intention was to
have all error checking in the lisp code, and none in c.

I want to thank Joerg for answering my questions regarding modules.  Also the document
he wrote is very helpful.
Dan Stanger

"Hoehle, Joerg-Cyril" wrote:

> _______________________________________________
> clisp-list mailing list
> [email-masked]
> https://lists.sourceforge.net/lists/listinfo/clisp-list