Next: , Previous: Tutorial-Comparison, Up: Tutorial


4.2 Getting a URL

The widely available libcurl is a library for downloading files over protocols like HTTP. We will use libcurl with CFFI to download a web page.

Please note that there are many other ways to download files from the web, not least the cl-curl project to provide bindings to libcurl via a similar FFI.1

libcurl-tutorial(3) is a tutorial for libcurl programming in C. We will follow that to develop a binding to download a file. We will also use curl.h, easy.h, and the man pages for the libcurl function, all available in the `curl-dev' package or equivalent for your system, or in the cURL source code package. If you have the development package, the headers should be installed in /usr/include/curl/, and the man pages may be accessed through your favorite man facility.


Footnotes

[1] Specifically, UFFI, an older FFI that takes a somewhat different approach compared to CFFI. I believe that these days (December 2005) CFFI is more portable and actively developed, though not as mature yet. Consensus in the free unix Common Lisp community seems to be that CFFI is preferred for new development, though UFFI will likely go on for quite some time as many projects already use it. CFFI includes the UFFI-COMPAT package for complete compatibility with UFFI.