Chapter 10. C API Reference Guide, Part I

The last two chapters of this book, Chapters Chapter 10 and Chapter 11, focus on aspects of the Apache module API that C-language programmers need to know. The majority of the API has already been covered in previous chapters, where we looked at it from the perspective of its Perl incarnation. We will briefly revisit each of the topics that we've already discussed in order to show you how the API appears in C. Topics that are specific to the C API, such as memory management, are covered in more detail.

Because the C API is so much of a recapitulation of the Perl API,[1] we won't show you as many complete examples in this chapter as we have in the previous ones, although there are still plenty of code snippets. For a complete C module skeleton, have a look at mod_example.c, which can be found in the Apache distribution in the directory src/modules/example. It implements handlers for each of the phases and writes out a log entry when each phase has been activated. For "how did they do that?" questions, peruse the source code for the standard modules in src/modules/standard. You'll also find a number of complete C API example modules at this book's companion web site, http://www.modperl.com.

[1] Technically, it's the other way around.

This chapter covers the most common parts of the API, including the data types that all handlers must know about, functions for manipulating arrays, tables, and resource pools, and techniques for getting and ...

Get Writing Apache Modules with Perl and C now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.