Share via


Compiling and Linking

To define the LDAP version of an application, call ldap_set_option with LDAP_OPT_VERSION and the appropriate option value. The default value is LDAP_VERSION2.

The header file Winldap.h contains declarations for the Microsoft implementation of the LDAP API. Include the header file Winsock2.h to add protocol and connection definitions.

Link to the LDAP import library Wldap.dll.

  • DLL: %systemroot%\system32\wldap32.dll
  • LIB: wldap32.lib

Ensure that the client application can find the library by:

  • Copying the library to the same folder as the client executable.
  • Copying the library to the system folder. -or-
  • Setting the PATH environment variable.

For more information about error handling, see Return Values.