I have written a library allowing libtcod to be used with Common Lisp. The source code repository is at:http://bitbucket.org/moriarty4/cl-tcod/
The readme file is pasted below.
Thanks for your excellent library.
---readme file follows---
This is CL-TCOD, an interface between Common Lisp and the Doryen Library
("libtcod"), a portable truecolour console library intended for use with
It consists of 2 parts:
1. TCOD.LISP, a lisp file which creates lisp bindings for C functions in the
compiled libtcod library. This is accompanied by TCOD.ASD, which (to be
brief!) allows TCOD to be easily loaded and used as a library by other
common lisp programs.
2. wrappers.c and wrappers.h. These are C files, and need to be added to the
sources for libtcod so that CL-TCOD can use the library. The reason this is
necessary is that some libtcod functions pass structures around as arguments
and return values, which common lisp (and a lot of other programming
languages that might want to interface with a C library) has great
difficulty dealing with. The wrapper C code converts these structures into
pointers to structures, which lisp can deal with more readily.
CL-TCOD has been tested with SBCL 1.0.22, CLISP 2.44, and Clozure 1.3 on
Linux. It should work on any common lisp implementation where CFFI works.
The latest version of CL-TCOD is available at: http://bitbucket.org/moriarty4/cl-tcod/
The latest version of libtcod is available at: http://jice.nospam.googlepages.com/thedoryenlibrary
This Common Lisp package depends on CFFI, the Common Foreign Function Interface: http://common-lisp.net/project/cffi/
A system definition file for use with ASDF is provided (tcod.asd), although it
is easy enough to simply load tcod.lisp if you are not using ASDF.
The CL-TCOD package is placed in the Public Domain by its authors.
You need to know your way around your chosen common lisp and how to install and
load lisp libraries before proceeding. You also need to have a working C
compiler, because you will need to recompile libtcod.
1. Ensure you have a working common lisp installation.
2. Ensure the ASDF lisp library is installed.
3. Put the CL-TCOD files in a directory where ASDF can find them.
4. Install CFFI (see above), also putting it somewhere ASDF can find it.
5. Put wrappers.c in the src/ directory of the libtcod sources.
6. Put wrappers.h in the include/ directory of the libtcod sources.
7. Open the makefile you will be using to compile libtcod (eg "makefile-linux").
Under the heading "LIBOBJS_C=\", add this line:
(Make sure the whitespace at the beginning of the line is tabs, NOT spaces.)
8. Compile libtcod, and put the resulting dynamically linked library (.DLL or
.SO file) somewhere your lisp system can find it. Example commands under linux:
make -f makefile linux
sudo cp libtcod*.so /usr/local/lib/
9. Start lisp. Load ASDF, CFFI, and then CL-TCOD:
(asdf:oos 'asdf:load-op :tcod)
10. Type something like the following at the lisp prompt to start using TCOD
from within Lisp:
(tcod:console-set-custom-font "myfont.bmp" :font-layout-ascii-in-row 16 16)
(tcod:console-init-root 80 25 "Test" nil)
(tcod:console-print-left tcod:*root* 1 1 :set "Hello, world!~%")