Directory Services


The ber_alloc_t function allocates and constructs a new BerElement structure.

BerElement* ber_alloc_t(
  INT options


[in] Bitwise OR of the options used when generating the encoding or decoding of the BerElement. The LBER_USE_DER flag (0x01) should always be specified, which causes the element lengths to be encoded in the minimum number of octets.

Unrecognized option bits are ignored.

Return Values

If the function succeeds, the return value is a pointer to the newly allocated BerElement structure.

If the function fails, it returns a NULL pointer.


The LBER_USE_DER option does not cause values of sets to be rearranged in tag and byte order or default values to be removed, so these functions are not sufficient for generating DER output as defined in X.509 and X.680. If the caller handles ordering values of sets correctly and removing default values, DER output as defined in X.509 and X.680 can be produced.

The allocated BerElement should be freed with ber_free.


Client: Included in Windows XP and Windows 2000 Professional.
Server: Included in Windows Server 2003 and Windows 2000 Server.
Redistributable: Requires Active Directory Client Extension on Windows NT 4.0 SP6a and Windows 95/98/Me.
Header: Declared in Winber.h.
Library: Use Wldap32.lib.

See Also

Functions, BerElement, ber_free, ber_printf