• Increase font size
  • Default font size
  • Decrease font size

Latest Posts for 'Extending'


The Netscape Plugin API

  Thursday, September 9th, 2010

The NPAPI is a cross-platform plain-C plugin interface used by several web browsers to allow custom native-code to handle certain content types. It is used by Firefox, Chrome, Konqueror, and Opera, among others. When a browser encounters a content type that a plugin wants to handle, it loads that plugin, allocates a region of the web page for the plugin to control and then streams data to it so that the plugin can render the data as it sees fit.

Adobe’s Acrobat, Shockwave, Flash renderers are examples of plugins built against this plugin API.

The following web page provides various resources for using the NPAPI:


The Apache Module API

  Thursday, September 9th, 2010

Apache is a web server project that aims to maintain an open-source HTTP server for modern operating systems. One of its goals is to provide an extensible server, which it achieves through a C plugin interface that lets users add new “modules” to the core server. Apache’s module interface is therefore an example of a widely-used C/C++ plugin API. The following page provides details on the Apache module API, including tutorials, code examples, and reference documentation.


DynObj Plugin Library

  Wednesday, September 8th, 2010

DynObj is a C/C++ library for creating cross-compiler plugin libraries from Arne Steinarson. It’s based on a shared type information system and allows you to load binary plugins and to interact with them in type safe ways.

The author notes the following potential uses of DynObj

  1. A program working with sound can install additional effect filters while running.
  2. A file manager can add plugins that handles new archive types.
  3. Or it can add file popup menu handlers, or toolbar commands from plugins.
  4. A text editor can add an editing mode (say Python editing) when the text editor is running.

Arne also provides a great background to the problem of creating cross-platform and cross-compiler plugins.


Building a Better Plugin Architecture

  Wednesday, September 8th, 2010

This article by Markus Ewald guides you through the design of a simple C++ plugin architecture based upon Factory classes. He also includes a fully working example implementation of his plugin system for you to download.

Markus presents a number of benefits of using plugins:

  1. Increased clarity and uniformity of code
  2. Improved modularization of code
  3. Shorter compile times
  4. Replacing/adding components

He also lists a further benefit of being able to use GPL code in a closed source project, although I do not believe that the GPL license allows this. The GPL FAQ states:

“If the program uses fork and exec to invoke plug-ins, then the plug-ins are separate programs, so the license for the main program makes no requirements for them. So you can use the GPL for a plug-in, and there are no special requirements. If the program dynamically links plug-ins, and they make function calls to each other and share data structures, we believe they form a single program, which must be treated as an extension of both the main program and the plug-ins. This means that combination of the GPL-covered plug-in with the non-free main program would violate the GPL.”


Building a C/C++ Plugin Framework

  Wednesday, September 8th, 2010

This Dr. Dobb’s article by Gigi Sayfan talks you through the various issues of creating a cross-platform plugin API in C/C++. This does a good job of diving into the binary compatibility issues with C++ plugins and presents a flexible framework that you can use on Windows, Mac OS X, and Linux. Sayfan uses the example of a simple role-playing game to demonstrate the ability to add non-player character plugins.


ABOUT THIS SITE

An Application Programming Interface (API) provides a logical interface to a piece of software and hides its internal details. This website is dedicated to a book on designing APIs for C++ and includes articles and links on API development.
 

SOURCE CODE

The book is accompanied by a source code package that contains many of the examples in the text. Download it for free.
 

OTHER BOOKS

Dr. Reddy has also published a computer graphics book called Level of Detail for 3D Graphics. Check it out too!.
 
Copyright (c) 2024 Martin Reddy. All rights reserved. Login