Node: Using Lpp, Next: , Previous: Installing Lpp, Up: Introduction

Using Lpp

Using the Lpp library is easy. First you need to include in your C++ file

     #include <Lpp.hh>

In some fussy cases you may want to include LppPure.hh here instead of Lpp.h, but Lpp.hh is always safe to use, See Pure Lisp Include File.

Second, you need to link the library libLpp.a with the compile of your C++ program. libLpp.a gets installed on your system when Lpp is installed, See Installing Lpp. For example on Linux if you had installed Lpp under /usr/local and then wrote a C++ program that used Lpp called then the following would first compile a program and then make an executable called pgm

     c++ -I/usr/local/include -c
     c++ -o pgm  main.o /usr/local/lib/lpp/libLpp.a

Then after that, if you are familiar with Common Lisp, you will find that writing programs using Lpp is similar to writing programs in Common Lisp. A big advantage is that you can mix quite freely the static style of C++ with the dynamic style of Lisp without having to think about it too much. In the next section we give a simple example to illustrate this.