Clementson's Blog

Bits and pieces (mostly Lisp-related) that I collect from the ether.

February 2008
Sun Mon Tue Wed Thu Fri Sat
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29
Jan  Mar

Summary of lispvan February meeting - Doing Evil Things with CL

Friday, February 29, 2008

For our February lispvan meeting, Brad Beveridge gave a presentation on "Doing Evil Things with CL". More specifically, he talked about how he was using CFFI and how he was generating CL bindings for C code. As is often the case, the project came about because he "had an itch to scratch" - Brad had worked previously with a friend on YAFFS (Yet Another Flash File System) and he was planning to do some more work on the project. However, he wanted to use Lisp as a "toolbench" for working with YAFFS C code to:

  1. Inspect internal YAFFS state
  2. Call random functions
  3. Add new functions/callbacks
  4. Do all the fun things you can do in a pure Lisp environment
So, he looked to CFFI for interfacing CL with YAFFS. However, there are a lot of bindings in YAFFS and he couldn't find any automated way to generate the bindings for CFFI (he looked at SWIG but found it to be only a partial solution). Since C/C++ debugger utilities need to know a lot about the program they're debugging, he decided to write a Lisp program that parsed the debug data directly from the C/C++ binary (created with debug info turned on) and generate the CFFI information from that. There were some limitations with the approach (i.e. - no way to get fully in-lined functions, C++ name-mangling has to be worked out on a per-compiler basis since it isn't standardized across C++ compilers); however, it worked quite well for him. This approach could potentially be extended to creating a C/C++ debugger in CL - an idea that the audience thought quite appealing!

Doing Evil Things with CL

Brad's presentation is available in ODP format and the movie of his presentation is available on Google Video. Note that the last few minutes have some interesting discussion even though the presentation has ended.

Update-2008-02-29: Zach converted Brad's ODP presentation into a PDF (which will be easier for some people to view).

emacs Copyright © 2008 by Bill Clementson