From: Adan Josuaius
Subject: Lisp->C
Date: 
Message-ID: <01bd901a$e2829500$dd6688c1@host.ist.utl.pt>
Can anyone tell me how can i import in a C/C++ program functions defined in

lisp ?


	Thanks

-- 

            Joao Salvado	
          (Adan  Josuaius)

      --------------------------
       INTELIGENCIA ARTIFICIAL
      Instituto Superior Tecnico
      --------------------------
       From IMAGINARIUM PALACE
      --------------------------

	"A geracao de numeros aleatorios e' demasiado importante
	 para ser deixada a' sorte..."

	"Minds are like parachutes, They only function when they 
	 are open"

------> ······@alfa.ist.utl.pt <------
--> http://alfa.ist.utl.pt/~l42633 <--
--------> bip: 0941-7-221624 <--------

	"Ser original e' ser igual a si mesmo, e' sair-se bem de uma situacao
embaracosa, e' encontrar a porta que da' a conhecer o desconhecido, e'
preferir o que os outros rejeitam.
	 Ser original e' mostrar-se nas coisas que se mostram, e' semear para
deixar colher um fruto novo, genuino e impregnado pelo espirito do
semeador."
						-Vergilio Ferreira

From: George Smith
Subject: Re: Lisp->C
Date: 
Message-ID: <6l8dbs$6ns$1@fu-berlin.de>
"Adan Josuaius" <······@alfa.ist.utl.pt> writes:

>Can anyone tell me how can i import in a C/C++ program functions defined in
>
>lisp ?

There is currently a thread in this newsgroup that would interest you
(porting lisp->c++).

Along the same lines, the lisp FAQ only mentions only one lisp-to-c
translator, a commercial product costing some $10000. I seem to remember a
posting here some time ago mentioning a free-for-non-commercial-use
lisp-to-c translator, maybe from a university in northern Germany, maybe
"only" for a subset of common lisp. Am I dreaming, or does this exist? 

George Smith
Institut fuer Germanistik
Universitaet Potsdam
From: see.signature
Subject: Re: Lisp->C
Date: 
Message-ID: <slrn6nfm31.e4.anyone@Flex111.dNWL.WAU.NL>
On 5 Jun 1998 09:22:04 GMT, George Smith <······@zedat.fu-berlin.de> wrote:
>"Adan Josuaius" <······@alfa.ist.utl.pt> writes:
>

>lisp-to-c translator, maybe from a university in northern Germany, maybe
>"only" for a subset of common lisp. Am I dreaming, or does this exist? 
>
just have a look at 

http://www.informatik.uni-kiel.de/~wg/apply.html

Marc

-- 
------------------------------------------------------------------------------
email: marc dot hoffmann at users dot whh dot wau dot nl
------------------------------------------------------------------------------
From: Axel Schairer
Subject: Re: Lisp->C
Date: 
Message-ID: <ydjsolkcaao.fsf@dfki.de>
······@zedat.fu-berlin.de (George Smith) writes:

> translator, a commercial product costing some $10000. I seem to remember a
> posting here some time ago mentioning a free-for-non-commercial-use
> lisp-to-c translator, maybe from a university in northern Germany, maybe
> "only" for a subset of common lisp. Am I dreaming, or does this exist? 

I seem to remember having read an article to that affect two or three
years ago and having posted the reference to this newsgroup once
before.  I could neither find the paper nor the article however.  I'll
have a look in the files tonight.

Axel
From: Axel Schairer
Subject: Re: Lisp->C
Date: 
Message-ID: <ydjlnrbddc7.fsf@dfki.de>
Axel Schairer <········@dfki.de> writes:

> ······@zedat.fu-berlin.de (George Smith) writes:
> 
> > translator, a commercial product costing some $10000. I seem to remember a
> > posting here some time ago mentioning a free-for-non-commercial-use
> > lisp-to-c translator, maybe from a university in northern Germany, maybe
> > "only" for a subset of common lisp. Am I dreaming, or does this exist? 
> 
> I seem to remember having read an article to that affect two or three
> years ago and having posted the reference to this newsgroup once
> before.  I could neither find the paper nor the article however.  I'll
> have a look in the files tonight.
> 
> Axel

There we are.  Hope it helps -- Axel 

@Article{goerigk96:kompllisp,
  author = 	 {Wolfgang Goerigk and Harold Boley and Ulrich
                  Hoffmann and Markus Oerling and Michael Sintek},
  title = 	 {{K}omplettkompilation von {L}isp: eine {S}tudie zur
                  {{\"U}}bersetzung von {L}isp-{S}oftware f{\"u}r
                  {C}-{U}mgebungen},
  journal = 	 {KI},
  year = 	 1996,
  volume =	 2,
  pages =	 {31--33}
}


@Article{attardi95:embedcommonlisp,
  author = 	 {Guiseppe Attardi},
  title = 	 {The Embeddable Common Lisp},
  journal = 	 {LISP Pointers},
  year = 	 1995,
  volume =	 {VIII},
  number =	 1,
  pages =	 {30--41}
}
From: Matt Curtin
Subject: Re: Lisp->C
Date: 
Message-ID: <86vhqfsx97.fsf@scooter.cis.ohio-state.edu>
······@zedat.fu-berlin.de (George Smith) writes:

> There is currently a thread in this newsgroup that would interest
> you (porting lisp->c++).

In that thread, William Paul Vrotney's Lpp is mentioned.  Since that
was posted, Lpp has been made available on the web at
<http://www.interhack.net/projects/lpp/>.

-- 
Matt Curtin ········@interhack.net http://www.interhack.net/people/cmcurtin/
From: Howard R. Stearns
Subject: Re: Lisp->C
Date: 
Message-ID: <35783811.1AB3@elwood.com>
The Lisp FAQ mentioned by some is a little out of date.  See instead the
Lisp implmentations page of the Association of Lisp Users
  http://www.elwood.com/alu/table/systems.htm

The ALU site also has a brief overview of combining Lisp with other
languages:
  http://www.elwood.com/alu/table/combine.htm

The Scheme world has its own set of Lisp->C implementations, to start
looking there see:
  http://www.elwood.com/alu/table/related-languages.htm#scheme

I am not familiar with Lpp (http://www.interhack.net/projects/lpp/), but
here's my understanding of the rest of the Lisp->C world.

The $10K software mentioned by George was from Chestnut software, which
is now out of business.  Their source and rights were acquired by a
major software vendor who uses it internally, and as I understand it,
has no plans to make it available.

CLiCC is a free university project that translates a SUBSET of Common
Lisp to C.
(http://www.cs.cmu.edu/afs/cs/project/ai-repository/ai/lang/lisp/impl/clicc/0.html,
I don't happen to have the more direct link, but the authors are
··@informatik.uni-kiel.de,
···@informatik.uni-kiel.de,··@informatik.uni-kiel.de)  I would be
interested to hear from anyone who has experience using CLiCC.

In between (costwise) is my company's product, Eclipse.
(http://www.elwood.com/eclipse-info)  Eclipse is $500 and is a complete
ANSI conforming Common Lisp that runs on both Unix and Windows.  It
comes with a C callable library of everything in Common Lisp, and allows
you to extend this by using COMPILE-FILE to convert Common Lisp source
to C.  The resulting C code uses normal C naming and calling
conventions, and is compatible with both K&R and ANSI/ISO C and C++
compilers.

ILOG (France) also has a product which uses a (ISLisp compliant?)
non-ANSI Lisp dialect and converts to C++.

Finally, there are some free CLtL-1 Lisps that are descendent from Kyoto
Common Lisp, which works by compiling Lisp to C and then using a C
compiler.  However, these are not, in my understanding, designed to
facilitate combining the generated C code with other C code.  I would be
interested to hear from anyone who has done this.  (Anyway, they are
listed at the ALU web page given above.)

Some issues to be aware of in calling Lisp functions from C:

 1. All the commerical Lisp systems allow you to load C code into a
running Lisp system, and allow Lisp code to call the loaded functions
and vice versa.  However, the Lisp executable/image is the "controlling
program" (i.e. the main()).
 
 2. If you create Lisp data and hold it within C code (i.e. in C
variables), you have to make sure that data doesn't get garbage
collected or moved on you.  There are two techniques for this:
   I. Use a conservative (i.e. C-stack-tracing), non-relocating garbage
collector (this is what Eclipse does), or
   II. Don't pass Lisp data to the C side -- instead, set up a registry
of C-available Lisp data and pass an index into that registry instead. 
The registry is traced by the garbage collector, and if the data moves,
the registry access utiltites can follow the move.  I am less familiar
with this technique, but I believe that this is what the other
commercial Lisp systems do with "foreign code".

 3. If you are going to combine any two systems into the same
executable, you have to be careful about name conflicts, etc.  Eclipse
uses package prefixes, etc., to maintain Lisp-2 and package semantics
within the more limited C-identifier rules.

Anyone who would like to discuss this further off-line, can reach me at
 ······@elwood.com, US telephone 414-764-7500.

Adan Josuaius wrote:
> 
> Can anyone tell me how can i import in a C/C++ program functions defined in
> 
> lisp ?
> 
>         Thanks
> 
> --
> 
>             Joao Salvado
>           (Adan  Josuaius)
> 
>       --------------------------
>        INTELIGENCIA ARTIFICIAL
>       Instituto Superior Tecnico
>       --------------------------
>        From IMAGINARIUM PALACE
>       --------------------------
> 
>         "A geracao de numeros aleatorios e' demasiado importante
>          para ser deixada a' sorte..."
> 
>         "Minds are like parachutes, They only function when they
>          are open"
> 
> ------> ······@alfa.ist.utl.pt <------
> --> http://alfa.ist.utl.pt/~l42633 <--
> --------> bip: 0941-7-221624 <--------
> 
>         "Ser original e' ser igual a si mesmo, e' sair-se bem de uma situacao
> embaracosa, e' encontrar a porta que da' a conhecer o desconhecido, e'
> preferir o que os outros rejeitam.
>          Ser original e' mostrar-se nas coisas que se mostram, e' semear para
> deixar colher um fruto novo, genuino e impregnado pelo espirito do
> semeador."
>                                                 -Vergilio Ferreira