Most application programs find it convenient to export all the names they use from the same C source module. In the following code fragment from example.c, the OM_EXPORT macro allocates memory for the constants that represent the OM object classes and directory attributes required for the read operation:
/* Define necessary Object Identifier constants
*/
OM_EXPORT(DS_A_COMMON_NAME)
OM_EXPORT(DS_A_COUNTRY_NAME)
OM_EXPORT(DS_A_ORG_NAME)
OM_EXPORT(DS_A_ORG_UNIT_NAME)
OM_EXPORT(DS_A_PHONE_NBR)
OM_EXPORT(DS_C_AVA)
OM_EXPORT(DS_C_DS_DN)
OM_EXPORT(DS_C_DS_RDN)
OM_EXPORT(DS_C_ENTRY_INFO_SELECTION)
The OM_EXPORT macro performs the following steps:
1. It defines a character array called OMP_D_ concatenated with the class_name input parameter.
2. It initializes this array to the value of a character string called OMP_O_ concatenated with the class_name input parameter. This value has already been defined in a header file.
3. It defines an OM_string data structure as the class_name input parameter.
4. It initializes the OM_string data structure's first component to the length of the array initialized in Step 2 and initializes the second component to a pointer to the value of the array initialized in Step 2.