From: Brandon J. Van Every
Subject: Talking to C++ legacy APIs?
Date: 
Message-ID: <c3vhug$2cshr4$1@ID-207230.news.uni-berlin.de>
Let's say you have decided that programming in Common Lisp is The Right Way
To Do Things [TM], but you've recognized the practical reality that lotsa
industrial APIs are C++ and will remain so for the forseeable future.  (For
instance, in my case DirectX or C++ 3D engines written on top of DirectX.)
How does a Lisper handle this problem?  Pursuing FAQs, archives, and Google,
I'm not entirely sure that they do... I'm hoping you can tell me that I've
missed something.  If I *have* missed something, then all I can say is the
internet is too noisy to find anything easily anymore, and we're stuck with
asking questions of human beings from here on out, if we expect to get
anything done in reasonable timeframes.  Anyways I've seen the question
asked several times over the past year, without satisfactory or even any
answers in a number of cases.

SWIG http://www.swig.org is the kind of off-the-shelf tool one would want,
but it has no support for Common Lisp.  Well, maybe that's not quite
accurate.  The homepage says, "SWIG can also export its parse tree in the
form of XML and Lisp s-expressions," but that doesn't sound like canned
off-the-shelf support of a language to me.  If there's some cookbook Lisp
method for utilizing such output that I'm simply unaware of, I'm happy to
learn about it... would be nice to see such knowledge canonized in a FAQ
someplace, or heck, made a part of SWIG.


-- 
Cheers,                       www.indiegamedesign.com
Brandon Van Every             Seattle, WA

"witch-hunt" - (noun) (Date: 1885)
1: a searching out for persecution of persons accused
   of witchcraft
2: the searching out and deliberate harassment of
   those (as political opponents) with unpopular views
- witch-hunter (noun)
- witch-hunting (noun or adjective)

From: Edi Weitz
Subject: Re: Talking to C++ legacy APIs?
Date: 
Message-ID: <m3n064ppot.fsf@bird.agharta.de>
On Thu, 25 Mar 2004 13:20:19 -0800, "Brandon J. Van Every" <·····························@yahoo.com> wrote:

> SWIG http://www.swig.org is the kind of off-the-shelf tool one would
> want, but it has no support for Common Lisp.  Well, maybe that's not
> quite accurate.  The homepage says, "SWIG can also export its parse
> tree in the form of XML and Lisp s-expressions," but that doesn't
> sound like canned off-the-shelf support of a language to me.  If
> there's some cookbook Lisp method for utilizing such output that I'm
> simply unaware of, I'm happy to learn about it... would be nice to
> see such knowledge canonized in a FAQ someplace, or heck, made a
> part of SWIG.

This one might be helpful:

  <http://www.google.com/groups?selm=uw5fzhduzsw.fsf_-_%40merkur.math.uni-magdeburg.de>

I suppose you know what UFFI is - otherwise pick the first Google
result.

Edi.
From: Kenny Tilton
Subject: Re: Talking to C++ legacy APIs?
Date: 
Message-ID: <33K8c.7657$DV6.1836@twister.nyc.rr.com>
Edi Weitz wrote:

> On Thu, 25 Mar 2004 13:20:19 -0800, "Brandon J. Van Every" <·····························@yahoo.com> wrote:
> 
> 
>>SWIG http://www.swig.org is the kind of off-the-shelf tool one would
>>want, but it has no support for Common Lisp.  Well, maybe that's not
>>quite accurate.  The homepage says, "SWIG can also export its parse
>>tree in the form of XML and Lisp s-expressions,"

Woo-hoo! I'll try it on OpenAL, the next library for Cello, where it's 
"All Libraries All the Time". This may also tie in with the Music Sig of 
Lisp-nyc.

Then text-to-speech (Festiva) and a physics engine (TokoMak). After that...

...more libraries!

kt

-- 
Home? http://tilton-technology.com
Cells? http://www.common-lisp.net/project/cells/
Cello? http://www.common-lisp.net/project/cello/
Why Lisp? http://alu.cliki.net/RtL%20Highlight%20Film
Your Project Here! http://alu.cliki.net/Industry%20Application
From: David Steuber
Subject: Re: Talking to C++ legacy APIs?
Date: 
Message-ID: <m2ptazhkux.fsf@david-steuber.com>
"Brandon J. Van Every" <·····························@yahoo.com> writes:

> Let's say you have decided that programming in Common Lisp is The Right Way
> To Do Things [TM], but you've recognized the practical reality that lotsa
> industrial APIs are C++ and will remain so for the forseeable future.  (For
> instance, in my case DirectX or C++ 3D engines written on top of DirectX.)

I would pick OpenGL over DirectX for 3D.  That said, DirectX is based
on COM.  COM can be accessed by C code.  Programmers using COM from C
just have to build the vtables by hand.  Microsoft cheated by simply
using the same structure that their C++ compiler produces.

C++ is only a pain because of the name mangling.  C++ uses the same
linker that C does.  The 'this' pointer is the first one passed in a
method call.  I haven't looked to see how templated functions,
clases, methods get named for the linker.

-- 
It would not be too unfair to any language to refer to Java as a
stripped down Lisp or Smalltalk with a C syntax.
--- Ken Anderson
    http://openmap.bbn.com/~kanderso/performance/java/index.html