Table of Contents | Previous | Next | Index

Netscape Directory SDK 3.0 for C Programmer’s Guide


Chapter 2
Using the Netscape Directory SDK for C

This chapter describes the Lightweight Directory Access Protocol (LDAP) Application Programming Interface (API) and the Netscape Directory SDK for C.

The chapter contains the following sections:

Understanding the LDAP API

The LDAP API consists of a set of functions that you can use to build LDAP clients. The LDAP API includes functions that allow you to connect to LDAP servers and perform standard LDAP functions, including:

For example, if you are writing an email application, you can use LDAP API functions to retrieve email addresses from an LDAP server.

The API functions allow you to perform LDAP operations synchronously or asynchronously.

The LDAP API also includes functions that implement the LDAP v3 protocol. For example, you can call functions to request extended operations from an LDAP v3 server.

Subsequent chapters in this manual explain how to use the LDAP API functions.

Working with the Netscape Directory SDK for C

The Netscape Directory SDK for C includes the header files and libraries for the LDAP API functions. You can include these header files and link to these libraries to enable your application to use LDAP.

Including the LDAP Header File

When writing your LDAP client, make sure to include the ldap.h header file.

#include <ldap.h>
The ldap.h header file declares the LDAP API functions.

If your client calls any of the LDAP SSL functions, make sure to include the ldap_ssl.h header file:

#include <ldap_ssl.h>

Compiling Clients on UNIX

The Netscape Directory SDK for C has an include directory (which contains the header files that you need to include) and a lib directory (which contains the shared libraries and object that you should link to).

When compiling clients on UNIX platforms, you need to link to the LDAP API shared library. The name of the library is different for the SSL-enabled and non-SSL versions of the SDK:

If you linked to the shared library, you need to make sure that the LDAP client can find the library. Do one of the following:

See the Makefile in the examples directory for examples of additional flags that you may need to specify when compiling and linking your LDAP client.

Compiling Clients on Windows

When compiling clients on Windows platforms, make sure to define _CONSOLE (if you are writing a console application) or _WINDOWS (if you are writing a standard Windows application).

Make sure to link to the LDAP API import library. The name of the library is different for the SSL-enabled and non-SSL versions of the SDK:

nsldap32v30bc.lib is the name of the import library for Borland compilers.

Make sure to copy the nsldap32v30.dll dynamic link library (for the non-SSL verison of the SDK) or nsldapssl32v30.dll (for the SSL-enabled version of the SDK) to a directory where your client can find it.

NOTE: Some Netscape servers (such as the Netscape Directory Server) install a different version of the nsldap32v30.dll in the Windows system32 directory. Make sure that your client finds the version of the DLL that is included with the Netscape Directory SDK for C before finding the version in the system32 directory. (For example, you can copy the SDK DLL to the same directory as your client application.)
During run-time, your client searches for the LDAP API dynamic link library in the following locations:

  1. The directory from which the application loaded.
  2. The current directory.
  3. The 32-bit Windows system directory. (In Windows 95, this directory is typically windows\system. In Windows NT, this directory is typically winnt\system32.)
  4. Note that a version of the LDAP API DLL may already exist in this directory. (For example, Netscape servers install a different version of this DLL in this directory.) To avoid potential conflicts, you should not install the DLL in this directory.

  5. (Windows NT only) The 16-bit Windows system directory. (This directory is typically winnt\system.)
  6. The Windows directory.
  7. The directories listed in the PATH environment variable.

Compiling Clients on Mac OS

When compiling clients on Mac OS, you need to link to the NSLDAPLib shared library.

You also need to make sure that the LDAP client can find the shared library. Do one of the following:


Table of Contents | Previous | Next | Index

Last Updated: 10/01/98 17:02:17