Subject: Windows95/NT

From: Bill Manaris <[email-masked]>
Date: Fri, 09 Oct 1998 17:04:20 -0500

Greetings,

Has anyone converted CLISP to a dynamic link library (DLL)?
If not, does anyone foresee any problems with doing so?

Background: We are converting the LISP prototype of a system
to Visual C/C++.  So, instead of re-writing functions like
append, remove-if, etc. from scratch in C++, it would be great
if we could DLLImport them.

Any suggestions or pointers would be very welcome.

Best regards,
Bill Manaris

--
Bill Manaris, Ph.D.
Computer Science Department
University of Southwestern Louisiana
2 Rex Street, CC400, P.O. Box 41771
Lafayette, LA 70504-1771, USA
Office:	(318)482-6306
Fax:	(318)482-2247

http://www.usl.edu/~manaris

---

From: [email-masked]
Date: Sat, 10 Oct 1998 10:04:07 -0400

> If not, does anyone foresee any problems with doing so?

I know of clicc which supports a subset of common lisp. (I found the
links to clicc from the comp.lang.lisp faq.)  I think that clicc does
something similar to what you want.

---

From: Bill Manaris <[email-masked]>
Date: Sun, 11 Oct 1998 17:58:08 -0500

I had looked at clicc earlier.  If I remember correctly,
it does not handle 'eval' which is one of the functions 
we need.  Thanks for the suggestion though.

---

From: Bruno Haible <[email-masked]>
Date: Mon, 12 Oct 1998 22:10:51 +0200 (MET DST)

> If not, does anyone foresee any problems with doing so?

Yes. Converting anything to a Windows DLL is not immediate. First, you have
to define C macros which expand to `dllexported' or `dllimported' depending
on context, and then you have to add these macros to most of your C header
file declarations. When you've done this, and it links, then you can start
debugging for real...

> if we could DLLImport them.

I doubt that this approach would work. The memory representations of
clisp and of C/C++ are pretty different. In particular, clisp would not
be able to determine the run-time type of C/C++ objects.

> Any suggestions or pointers would be very welcome.

Try writing a C++ class for lists, another for extensible vectors, another
for reference counted strings, and so on. Thousands of C++ programmers have
already done this. There are no good predefined data types, like in Common
Lisp. That's C++.

Bruno

! To unsubscribe from the clisp-list mailing list, send mail to     !
!                    [email-masked]                        !
! including the two words "unsubscribe clisp-list" as message body. !

---

From: Bill Manaris <[email-masked]>
Date: Mon, 12 Oct 1998 16:28:06 -0500

Bruno,

>be able to determine the run-time type of C/C++ objects.

I was hoping to let CLISP do it for me.  That is, use the reader 
to get a pointer to an internal representation of some s-expression.
Then pass this pointer to other DLLimported CLISP functions 
(append, cons, eval, etc.) .  Finally use the printer (or a modified 
version of it) to convert the result to an external (C-string) 
representation.  Thus, CLISP does what it does best!

I am not sure if garbage collection might be a problem.

Cheers,
Bill

---

From: Bruno Haible <[email-masked]>
Date: Tue, 13 Oct 1998 00:18:10 +0200 (MET DST)

Bill Manaris writes:

> representation.

Ah, I see. If you mean to _convert_ between one of your C++ objects and
a CLISP object, for example a CLISP string, then yes, you can do that.
You could represent the C++ object at address 0x403abe0 by the Lisp string
"0403ABE0", then manipulate lists of strings and finally convert a Lisp
result back. That would work. - Or, alternatively, use the FFI.

The limitations of both approaches would be the same: Within Lisp, you
only got "handles" to your C++ objects.

Bruno

---

From: Rodrigo Ventura <[email-masked]>
Date: Tue, 13 Oct 1998 13:45:35 GMT

>>>>> "Bruno" == Bruno Haible <[email-masked]> writes:

    Bruno> result back. That would work. - Or, alternatively, use the FFI.

        BTW, is CLISP's FFI working? If yes, where can I find the
documentation to work with it? Does CLISP already support dynamic
linking of shared objects? I found a chapter on some sort of FFI on a
terribly old CLISP manual, but I _hope_ it is outdated (it required
recompiling CLISP, I guess, in a disappointing hack-sounding fashion).

        Regards,

-- 
--

*** Rodrigo Martins de Matos Ventura, alias <Yoda>
***  [email-masked], http://www.isr.ist.utl.pt/~yoda
***   Instituto de Sistemas e Robotica, Polo de Lisboa
***    Instituto Superior Tecnico, Lisboa, Portugal
***     PGP Public Key available on my homepage
*** Key fingerprint = 0C 0A 25 58 46 CF 14 99  CF 9C AF 9E 10 02 BB 2A