Hi,
I'm new in LISP programming language but I've
already developed a very
nice set of functions wich will be part of a
(simple) Expert System I'm
writing. These functions have been developed using
only pure functional
characteristics the language offers (so there is
not "for", "set", ecc... )
and I don't intend to add these behaviours in the
future too.
Well, my problem is that I'd like to make a
library that exports these
functions so that I'll be able to use them inside
an existing C++ source
code!
Is it possible to make this library? Isn't
there any other solution?
How can I make it running?
How can I get access to these functions from
inside the C++ code?
Of curse I develop with Emacs, under THE operating
system: LINUX :-),
but.... it would be better if I'll can compile
also with Win NT/2000
environment :-(.
Thank's in advance for any advice and....
sorry for my bad english :-)
Acaro79
From: Gabe Garza
Subject: Re: "Merging" LISP and C++, is it possible?
Date:
Message-ID: <n12oa9mv.fsf@kynopolis.org>
I've taken the liberty of re-formatting your post, I hope you
don't mind.
"Acaro" <········@inwind.it> writes:
> Hi, I'm new in LISP programming language but I've already developed
> a very nice set of functions wich will be part of a (simple) Expert
Which Lisp? This question is very specific to not only the
type of Lisp you're using (Common Lisp--which is what this newsgroup
is largely about, Scheme, Emacs Lisp, etc.) but also the specific
implementation (CMUCL, clisp, LispWorks, Allegro Common Lisp, etc.).
> [ bit about style snipped ]
> Well, my problem is that I'd like to make a library that exports
> these functions so that I'll be able to use them inside an existing
> C++ source code!
> Is it possible to make this library? Isn't there any other solution?
> How can I make it running? How can I get access to these functions
> from inside the C++ code?
For most Common Lisps, calling into it from another language is
often either impossible or very hairy. I think Xanalys can make DLL's
on windows--that's the only implementation I can think of that tries
to. I'd be really interested in knowing if there were other full-blown
implementations that allow it.
You may want to look at ECLS, which is a Common Lisp dialect
intended to be embedded into other languages. It's not the same as
making your functions into a library, but it could get you to the
same end: http://sourceforge.net/projects/ecls/
Gabe Garza
> Which Lisp? This question is very specific
to not only the
> type of Lisp you're using (Common Lisp--which is
what this newsgroup
> is largely about, Scheme, Emacs Lisp, etc.) but
also the specific
> implementation (CMUCL, clisp, LispWorks, Allegro
Common Lisp, etc.).
>
> > [ bit about style snipped ]
Actually I'm using Emacs Lisp, or better, I'm
writing my code with Emacs 19.34.4 but I've used
ONLY pure Common Lisp functions and facilities!
I've writed the following lines on head of each
source of mine:
(include 'cl)
(include 'cl-19)
My goal is to write the engine of this simple
expert system using only functional-programming
paradigm, so I needn't any implementation-specific
features.
The code we write by this way should be portable
into differents productor-specific implementation,
isn't it?!???
> For most Common Lisps, calling into it from
another language is
> often either impossible or very hairy. I think
Xanalys can make DLL's
> on windows--that's the only implementation I can
think of that tries
> to. I'd be really interested in knowing if
there were other full-blown
> implementations that allow it.
>
> You may want to look at ECLS, which is a
Common Lisp dialect
> intended to be embedded into other languages.
It's not the same as
> making your functions into a library, but it
could get you to the
> same end: http://sourceforge.net/projects/ecls/
Thank's, I'm going to see this page; it seem to be
interesting but I wolud prefer, if possible, a
different solution, may be Xanalys is this.
On Thu, 18 Oct 2001 21:59:48 +0200, "Acaro" <········@inwind.it> wrote:
> I'm new in LISP programming language but I've
> already developed a very
> nice set of functions wich will be part of a
> (simple) Expert System I'm
> writing. These functions have been developed using
> only pure functional
> characteristics the language offers (so there is
> not "for", "set", ecc... )
Why did you use only pure functional features? Any problems with mutation
forms?
Paolo
--
EncyCMUCLopedia * Extensive collection of CMU Common Lisp documentation
http://web.mclink.it/amoroso/ency/README
[http://cvs2.cons.org:8000/cmucl/doc/EncyCMUCLopedia/]
From: Edward Fagan
Subject: Re: "Merging" LISP and C++, is it possible?
Date:
Message-ID: <ey3sncfee5r.fsf@dom.ain>
* Paolo Amoroso wrote:
> Why did you use only pure functional features? Any problems with mutation
> forms?
They CORRUPT YOUR PRECIOUS BODILY FLUIDS, everyone knows that. why
do you think they call them MUTATION forms? Lisp must be PURIFIED of
these EVIL CONTAMINANTS.
From: Kenny Tilton
Subject: Re: "Merging" LISP and C++, is it possible?
Date:
Message-ID: <3BD0B7A2.FA85D913@nyc.rr.com>
Acaro wrote:
>
> Well, my problem is that I'd like to make a
> library that exports these
> functions so that I'll be able to use them inside
> an existing C++ source
> code!
>
Well I just checked the Corman CL Site:
http://www.corman.net/features.html
That page mentions "Foreign Callbacks into Lisp", sounds promising.
kenny
clinisys
On Fri, 19 Oct 2001 23:29:45 GMT, Kenny Tilton <·······@nyc.rr.com> wrote:
>Acaro wrote:
>
>>
>> Well, my problem is that I'd like to make a
>> library that exports these
>> functions so that I'll be able to use them inside
>> an existing C++ source
>> code!
>>
>
>Well I just checked the Corman CL Site:
>
> http://www.corman.net/features.html
>
>That page mentions "Foreign Callbacks into Lisp", sounds promising.
>
Yes, foreign code can call lisp functions, but currently that foreign code needs
to call from a thread that lisp has created. This is because the garbage
collector only knows about lisp threads. Practically, this is useful for calling
DLL functions, and passing callbacks into lisp (such as many Windows OS
functions require).
We hope to add more support for directly calling into lisp, and exports lisp
function entry points in DLLs, in the near future. I have in mind a feature
which will allow foreign threads to be "blessed" by the lisp system, so they can
be used to directly call into the system.
Roger
On Sat, 20 Oct 2001 11:24:27 +0200, Fernando <···@wanadoo.es> wrote:
>On Sat, 20 Oct 2001 05:10:31 GMT, ·····@corman.net (Roger Corman) wrote:
>
>>On Fri, 19 Oct 2001 23:29:45 GMT, Kenny Tilton <·······@nyc.rr.com> wrote:
>>>Acaro wrote:
>>>
>
>>Yes, foreign code can call lisp functions, but currently that foreign code needs
>>to call from a thread that lisp has created.
>
>You mean it's impossible to call lisp functions from another app? I was
>planning to use CormanLisp as a 'scripting language' for a C++ app. Is this
>impossible then? I thought it would be easy to communicate with it via
>COM....
You can load it, as an in-process COM server (see sample programs)
and then talk to it. It's just that you can only control it by executing lisp
expressions i.e text in, text out. You can't get a callback, from another
thread, and execute it directly. It can call you, on one if its threads, and
hand you a callback, which you can then use to call into lisp.
I think it will work well as a scripting language, because the lisp code is then
in control.
Roger
Acaro <········@inwind.it> wrote:
> Hi,
> I'm new in LISP programming language but I've
> already developed a very
> nice set of functions wich will be part of a
> (simple) Expert System I'm
> writing. These functions have been developed using
> only pure functional
> characteristics the language offers (so there is
> not "for", "set", ecc... )
> and I don't intend to add these behaviours in the
> future too.
... try Allegro CL. it have posibilities
to create libraries. But if it's a very simple
lisp code then try SIOD. Regards
Adam Przybyla