Next: , Up: Dynamic Extensions   [Contents][Index]


16.1 Introduction

An extension (sometimes called a plug-in) is a piece of external compiled code that gawk can load at runtime to provide additional functionality, over and above the built-in capabilities described in the rest of this Web page.

Extensions are useful because they allow you (of course) to extend gawk’s functionality. For example, they can provide access to system calls (such as chdir() to change directory) and to other C library routines that could be of use. As with most software, “the sky is the limit”; if you can imagine something that you might want to do and can write in C or C++, you can write an extension to do it!

Extensions are written in C or C++, using the application programming interface (API) defined for this purpose by the gawk developers. The rest of this chapter explains the facilities that the API provides and how to use them, and presents a small example extension. In addition, it documents the sample extensions included in the gawk distribution and describes the gawkextlib project. See Extension Design, for a discussion of the extension mechanism goals and design.