| Register | FAQ | Calendar | Search | Today's Posts | Mark Forums Read |
|
#1
| |||
| |||
| Hello, I am not a lisper - and just curious about the language, because it comes with quite a few concepts that are really nice... But one question, because this would be a knockout criteria for me to dive deeper into Lisp (if I had the time and need for that diving): Does CL or one of it's implementations have a C interface, so that one could integrate number crunching libraries and other neat stuff that is written in C? Thanks in advance E. |
|
#2
| |||
| |||
| On Fri, 18 Jan 2008 12:38:03 +0100, EL <eckhardnospam@gmx.de> wrote: > But one question, because this would be a knockout criteria for me to > dive deeper into Lisp (if I had the time and need for that diving): > Does CL or one of it's implementations have a C interface, so that one > could integrate number crunching libraries and other neat stuff that is > written in C? http://common-lisp.net/project/cffi/ > > Thanks in advance > E. -- Using Opera's revolutionary e-mail client: http://www.opera.com/mail/ |
|
#3
| |||
| |||
| Pĺ Fri, 18 Jan 2008 12:38:03 +0100, skrev EL <eckhardnospam@gmx.de>: > Hello, > > I am not a lisper - and just curious about the language, because it > comes with quite a few concepts that are really nice... > > But one question, because this would be a knockout criteria for me to > dive deeper into Lisp (if I had the time and need for that diving): > Does CL or one of it's implementations have a C interface, so that one > could integrate number crunching libraries and other neat stuff that is > written in C? > > Thanks in advance > E. The bad news is that a C interface not defined in the standard. The good news is that every Lisp implementation has one. So to determine how to interface lisp to SO/DLL, COM, .NET, JNI you have to consult the implementation documentation. There are also portable layers above the native foreign function interface that allow portable access do SO/DLL. Mainly the external libraries CFFI and UFFI. -------------- John Thingstad |
|
#4
| |||
| |||
| John Thingstad schrieb: > The bad news is that a C interface not defined in the standard. > The good news is that every Lisp implementation has one. > So to determine how to interface lisp to SO/DLL, COM, .NET, JNI you have > to consult the implementation documentation. There are also portable > layers above the native foreign function interface that allow portable > access do SO/DLL. Mainly the external libraries CFFI and UFFI. Thanks for the fast answers... CFFI and UFFI look good. Does anybody have experience with them - how (easy) is type conversion - e.g. C structures <-> CL types & how is the overall handling? Which one is more recomendable? Or are the implementation specific interfaces better yet? E. |
|
#5
| |||
| |||
| yes there is look for "Foreign Function Interface" http://www.sbcl.org/manual/Introduct...tion-Interface btw. there is good enough CL implementation for that kind of stuff, Sbcl for example |
|
#6
| |||
| |||
| On Fri, 18 Jan 2008 13:16:05 +0100, EL <eckhardnospam@gmx.de> wrote: > CFFI and UFFI look good. Does anybody have experience with them - how > (easy) is type conversion - e.g. C structures <-> CL types & how is the > overall handling? Which one is more recomendable? I would recommend CFFI. It supports all major implementations. C structs, types, callbacks and the like are handled quite nicely ("in a lispy fashion" if you will: slot-value becomes foreign-slot-value etc.). The online doc is very good. I have some experience with CFFI and I like it, but probably you'll find enough people who will say the same for UFFI. > Or are the implementation specific interfaces better yet? AFAIK CFFI is basically a common wrapper around the implementation specific interfaces. Peter > > > E. -- Using Opera's revolutionary e-mail client: http://www.opera.com/mail/ |
|
#7
| |||
| |||
| Peter Hildebrandt wrote: > On Fri, 18 Jan 2008 13:16:05 +0100, EL <eckhardnospam@gmx.de> wrote: > >> CFFI and UFFI look good. Does anybody have experience with them - how >> (easy) is type conversion - e.g. C structures <-> CL types & how is >> the overall handling? Which one is more recomendable? > > > I would recommend CFFI. It supports all major implementations. C > structs, types, callbacks and the like are handled quite nicely ("in a > lispy fashion" if you will: slot-value becomes foreign-slot-value > etc.). The online doc is very good. > > I have some experience with CFFI and I like it, but probably you'll > find enough people who will say the same for UFFI. No, CFFI is basically a step beyond UFFI, functionally the next generation and covering more Lisps, all Lisps for all intents and purposes. Implementationally... > >> Or are the implementation specific interfaces better yet? > > > AFAIK CFFI is basically a common wrapper around the implementation > specific interfaces. ....in some case CFFI wraps the implementation FFI as does UFFI, in other cases it digs a little deeper. I never actually looked very hard at the mechanics, but I think the CFFI page offers some deets. kt -- http://www.theoryyalgebra.com/ "In the morning, hear the Way; in the evening, die content!" -- Confucius |
|
#8
| |||
| |||
| EL <eckhardnospam@gmx.de> writes: > CFFI and UFFI look good. Does anybody have experience with them - how > (easy) is type conversion - e.g. C structures <-> CL types & how is > the overall handling? Which one is more recomendable? CFFI's documentation includes a nice tutorial written by Stephen Compall that might address many of your questions. Quoting the first paragraph: “Users of many popular languages bearing semantic similarity to Lisp, such as Perl and Python, are accustomed to having access to popular C libraries, such as GTK, by way of “bindings”. In Lisp, we do something similar, but take a fundamentally different approach. This tutorial first explains this difference, then explains how you can use CFFI, a powerful system for calling out to C and C++ and access C data from many Common Lisp implementations.” <http://common-lisp.net/project/cffi/manual/html_node/Tutorial.html> -- LuĂ*s Oliveira http://student.dei.uc.pt/~lmoliv/ |
![]() |
| Thread Tools | |
| Display Modes | |
In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.