Programming Guidelines

The project goal is to develop a robust, stable LDAP suite. We have adopted various guidelines to help meet this goal. This document details programming guidelines.

Developers should also read:


General Programming Guidelines

Engineering Approach

Coding Style

We have adopted a few basic style guidelines designed to facilate merges between different versions of OpenLDAP software. Without these restrictions we would not be able to accept changes made against the various versions of OpenLDAP Software (and other U-Mich derived LDAP implementations).

Developers should review their diffs and and eliminate any unnecessary changes before submitting (or committing) them.

Language Specific Guidelines

OpenLDAP utilizes a number of different languages:

C Programming

The majority of OpenLDAP software is written in the C Programming Language. The code is designed such that most modern C translators can be used to build the software. In general, programmers are allowed to use most Standard C constructs. However, we've found that the following restrictions need to observed:

portable.h Restrictions

C source files (ie: source.c) should include the portable.h header and do so first and foremost. The only exception to this restrictions are contrib packages which have independent build systems.

Failure to include this file first will result in improper definitions and declarations.

Non-exposed header files can and should assume portable.h has been included. portable.h should never be included by any exposed header.

Exposed Header Restrictions

OpenLDAP supports application development using non-Standard C translators including: This requires OpenLDAP Software exposed (ie: installed) header files to be generic and very portable. Exposed headers should:

Note: portable.h is not exposed.

Bourne Shell Programming

A number of scripts are written as Bourne Shell, sh(1), scripts. These include configuration scripts, test scripts, and make(1) rules.

The Bourne Shell is used for these scripts to gain portability across a wide range of platforms. However, implementations of sh(1) can vary widely. As such, the programmer should attempt to use only those features that are commonly available.


© Copyright 2014, OpenLDAP Foundation. Privacy Statement
$Id: 8d96a270121cd1c79ba614ac50e2cea634d0c598 $