Re: Interfacing with C++
Hi Camille,
Not sure what you mean about a C++ interface, unless you are referring to name-mangling? In that case, I know of no universal interface techniques, from any language, to C++, simply because name-mangling is not standardized. So, in general, I usually *do* write glue code for Lispworks in C++, but you must always use an interface bridge that is compiled as:
extern "C" { ... };
This leaves the names of the routines contained within the braces un-mangled.
Next, there is the issue of the prefix underscore in C names. Dating way back to the early 70's (perhaps earlier?) most C compilers adopted the convention that whatever names you use in your program would be shown to the linker as prefixed with an underscore, presumably to leave room for Assembly language names that would not clash. I think this convention still abides today, and that has to do with the nature of the FLI interface name that you choose. I normally use a string with matching case to the C name, and specify :SOURCE as the convention in the name.
There are numerous examples of all of this stuff in my repositories
https://github.com/dbmcclain/LispPlotter/tree/master/mac-c-gluecode-64
https://github.com/dbmcclain/LispPlotter/tree/master/mac-c-gluecode-32
Hope this helps??
- DM
On Jan 16, 2013, at 02:29 AM, Camille Troillard <camille@osculator.net> wrote:
>
> Hello,
>
> I need to interface with a C++ library on Mac OS X and Windows.
> Do you have already done this and have an advice to share?
>
> It seems LispWorks once had a C++ foreign language interface, why is it no longer available?
>
>
> All the best,
> Cam
>
>
> _______________________________________________
> Lisp Hug - the mailing list for LispWorks users
> lisp-hug@lispworks.com
> http://www.lispworks.com/support/lisp-hug.html
>
>
Dr. David McClain
CTO & Co-Founder
Acudora (TM)
e-mail: david@acudora.com
Tel: (+1) 520-529-2437
_______________________________________________
Lisp Hug - the mailing list for LispWorks users
lisp-hug@lispworks.com
http://www.lispworks.com/support/lisp-hug.html