Compiling, linking, and running a program
The LDAP API is supplied in a C DLL that is loaded at program run time, enabling a program to call the functions of the interface. The following rules apply to compiling and link-editing programs that use the LDAP API.
Rules
- Include the
ldap.hheader file in all C or C++ source files that make calls to the LDAP API. If you use SSL/TLS, you must include theldapssl.hinclude file after theldap.hinclude file. - When compiling, specify
-Wc,DLLon the compile of all modules that make calls to the LDAP API. - When linking the program, specify
-Wl,DLLand include an LDAP sidefile as one of the files to be linked with the program. The LDAP sidefiles are:/usr/lib/GLDCLDAP.xfor 31-bit applications/usr/lib/GLDCLD64.xfor 64-bit applications
- Ensure that your application has
POSIX(ON)so it can use the LDAP API. - When running the program, ensure that the LDAP DLL is accessible.
The DLL is supplied in the
SYS1.SIEALNKEdata set.- The 31-bit DLL is
GLDCLDAP. - The 64-bit DLL is
GLDCLD64.
- The 31-bit DLL is
- Call the setlocale() routine to set the current locale before the first call to an LDAP API.
- If you are using SSL/TLS or Kerberos authentication, you must
use the
SYS1.SIEALNKEdata set.
Makefile and README files are shipped in /usr/lpp/ldap/examples to
explain how to build the LDAP sample applications. You might be able
to use this information as a base for building your LDAP application.
Using TSO and batch jobs
If you are using TSO and batch jobs to compile, link, and run LDAP
client applications, you must be aware of the following additional
information:
- Data set GLDHLQ.SGLDHDRC contains the LDAP header files.
- Data set GLDHLQ.SGLDEXPC contains the sidefiles.
POSIX(ON)must be specified as a runtime option because the default for this environment isPOSIX(OFF).