From: Zhijun William Zhang
Subject: Calling C++ functions from Lisp
Date: 
Message-ID: <2vh6au$jc@ringding.cs.umd.edu>
Does anybody have experience calling C++ functions from Lucid/Allegro-PC/Allegro-SUN Common Lisp? 

Any clue is appreciated.

From: Karsten Poeck
Subject: Re: Calling C++ functions from Lisp
Date: 
Message-ID: <poeck-0707941913450001@wi6a65.informatik.uni-wuerzburg.de>
In article <·········@ringding.cs.umd.edu>, ···@cs.umd.edu (Zhijun William
Zhang) wrote:

> Does anybody have experience calling C++ functions from
Lucid/Allegro-PC/Allegro-SUN Common Lisp? 
> 
> Any clue is appreciated.
I assume it is the same for all three.
You can call ordinary c finction via the ffi and they can call the c++ function

Karsten
From: Fernando Mato Mira
Subject: Re: Calling C++ functions from Lisp
Date: 
Message-ID: <2vhjes$jt4@disuns2.epfl.ch>
In article <······················@wi6a65.informatik.uni-wuerzburg.de>, ·····@informatik.uni-wuerzburg.de (Karsten Poeck) writes:

> > Does anybody have experience calling C++ functions from
> Lucid/Allegro-PC/Allegro-SUN Common Lisp? 
> > 
> > Any clue is appreciated.
> I assume it is the same for all three.
> You can call ordinary c finction via the ffi and they can call the c++ function

Or you can buy Harlequin LispWorks and forget about the others till
they are able to process C and C++ header files..

-- 
F.D. Mato Mira                           
Computer Graphics Lab    ········@epfl.ch
EPFL                     FAX: +41 (21) 693-5328
From: Jason Trenouth
Subject: Re: Calling C++ functions from Lisp
Date: 
Message-ID: <JASON.94Jul21135246@monty.harlqn.co.uk>
>>>>> Does anybody have experience calling C++ functions from
>>>>> Lucid/Allegro-PC/Allegro-SUN Common Lisp?
>>>>> Any clue is appreciated. 

>>>> I assume it is the same for all three.  You can call ordinary c
>>>> finction via the ffi and they can call the c++ function

>>> Or you can buy Harlequin LispWorks...

>  By the way, somebody pointed out that LispWorks will only
> work with GNU C++ now.  I just checked with LispWorks
> support and they said:

>> The latest version of the C++ interface will be compatible with any
>> C++ compiler.  This will be available early next month.

>  (where `any' = `any on any' or `any on SGI' ??)
> 
> Better confirm everything before you buy..

'any' = Any ARM-compatible C++ compiler on the UNIX platforms we support:
	SUN Sparc, DEC Alpha, DEC Mips, HP PA, SGI Mips, IBM RS6k

Jason
--
_____________________________________________________________________________
| Jason Trenouth,                        | EMAIL: ·····@uk.co.harlequin     |
| Harlequin Ltd, Barrington Hall,        | TEL:   (0223) 872522             |
| Barrington, Cambridge CB2 5RG, UK      | FAX:   (0223) 872519             |
From: Marco Antoniotti
Subject: Re: Calling C++ functions from Lisp
Date: 
Message-ID: <MARCOXA.94Jul22140632@mosaic.nyu.edu>
In article <···················@monty.harlqn.co.uk> ·····@harlequin.co.uk (Jason Trenouth) writes:

   From: ·····@harlequin.co.uk (Jason Trenouth)
   Sender: ······@harlequin.co.uk (Usenet Maintainer)
   Organization: Harlequin Ltd, Barrington Hall, Cambridge UK
   Date: Thu, 21 Jul 1994 12:52:46 GMT
   Lines: 30


   'any' = Any ARM-compatible C++ compiler on the UNIX platforms we support:
	   SUN Sparc, DEC Alpha, DEC Mips, HP PA, SGI Mips, IBM RS6k

Does "ARM-compatible" mean "Using the mangling scheme of the ARM"?

Marco
--
Marco Antoniotti - Resistente Umano
-------------------------------------------------------------------------------
Robotics Lab		| room: 1220 - tel. #: (212) 998 3370
Courant Institute NYU	| e-mail: ·······@cs.nyu.edu

...e` la semplicita` che e` difficile a farsi.
...it is simplicity that is difficult to make.
				Bertholdt Brecht
From: Rainer Schmitz [swift]
Subject: Re: Calling C++ functions from Lisp
Date: 
Message-ID: <SCHMITZ.94Jul8112456@fue08.iitb.fhg.de>
>>>>> "poeck" == Karsten Poeck <·····@informatik.uni-wuerzburg.de> writes:
In article <······················@wi6a65.informatik.uni-wuerzburg.de> ·····@informatik.uni-wuerzburg.de (Karsten Poeck) writes:


poeck> In article <·········@ringding.cs.umd.edu>, ···@cs.umd.edu (Zhijun
poeck> William Zhang) wrote:

>> Does anybody have experience calling C++ functions from
>> Lucid/Allegro-PC/Allegro-SUN Common Lisp? 
>> 
>> Any clue is appreciated.
poeck> I assume it is the same for all three.  You can call ordinary c
poeck> finction via the ffi and they can call the c++ function

It is possible to use the ffi to call c++ functions directly. You have to
provide a function to convert the function names produced by the c++
compiler to names understood from Lisp:

;;;converter function
(defun C++-symbol-name (lisp-symbol &key language)
  "Konvertiert Lisp-Symbol zu C++-Namen. 
Das foreign-function-interface von Allegro CL 4.2 ist nur f�r C und Fortran ausgelegt. Diese Funktion erzeugt Namen, wie sie vom C++-Linker erzeugt werden."
  (declare (ignore language))
  (format nil "_~(~A~)__Fi" lisp-symbol))

;;;expample for defforeign
(ff:defforeign ',c-proc-name
	   :arguments '(integer)
	   :return-type :void
	   :convert-symbol #'C++-symbol-name
	   :pass-types '(:by-value))


swift
--
Rainer Schmitz
c/o Fraunhofer-Institut f�r Informations- und Datenverarbeitung (IITB)
Fraunhoferstr. 1, D-76131 Karlsruhe, FRG
Email: ·······@iitb.fhg.de Phone: +49 721 6091-316 Fax: +49 721 6091-413
From: Marco Antoniotti
Subject: Re: Calling C++ functions from Lisp
Date: 
Message-ID: <MARCOXA.94Jul10112433@mosaic.nyu.edu>
In article <····················@fue08.iitb.fhg.de> ·······@iitb.fhg.de (Rainer Schmitz [swift]) writes:


   From: ·······@iitb.fhg.de (Rainer Schmitz [swift])
   Newsgroups: comp.lang.lisp
   Date: 08 Jul 1994 09:24:56 GMT
   Organization: Fraunhofer-Gesellschaft IITB
   Lines: 39
   References: <·········@ringding.cs.umd.edu>
	   <······················@wi6a65.informatik.uni-wuerzburg.de>


   It is possible to use the ffi to call c++ functions directly. You have to
   provide a function to convert the function names produced by the c++
   compiler to names understood from Lisp:

   ;;;converter function
   (defun C++-symbol-name (lisp-symbol &key language)
     "Konvertiert Lisp-Symbol zu C++-Namen. 
   Das foreign-function-interface von Allegro CL 4.2 ist nur f�r C und Fortran ausgelegt. Diese Funktion erzeugt Namen, wie sie vom C++-Linker erzeugt werden."
     (declare (ignore language))
     (format nil "_~(~A~)__Fi" lisp-symbol))

   ;;;expample for defforeign
   (ff:defforeign ',c-proc-name
	      :arguments '(integer)
	      :return-type :void
	      :convert-symbol #'C++-symbol-name
	      :pass-types '(:by-value))

First of all you are using Allegro and that does not mean that other
Lisp FFI's make the same assumptions. (Does this ring a bell out
there? :) ).

Second you are also making assumptions on your C++
enviroment. I.e. you make assumptions on the name mangling scheme of
your C++ implementation.

It is a good start though. I just want to point out that C++ make
things messy for itself when it comes to linking in other C++
libraries (e.g. cfront vs. g++).

Cheers
--
Marco Antoniotti - Resistente Umano
-------------------------------------------------------------------------------
Robotics Lab		| room: 1220 - tel. #: (212) 998 3370
Courant Institute NYU	| e-mail: ·······@cs.nyu.edu

...e` la semplicita` che e` difficile a farsi.
...it is simplicity that is difficult to make.
				Bertholdt Brecht