[Haskell-cafe] Suggestions for #defines with FFI

John Goerzen jgoerzen at complete.org
Wed Jul 27 16:48:37 EDT 2005


On Wed, Jul 27, 2005 at 03:01:18PM -0400, Dimitry Golubovsky wrote:
> John,
> 
> Could you please give an example of such constant definitions? Is it
> possible to look at the include file?

Sure.  I'm writing an interface to OpenLDAP.  So, from ldap.h, we see:

#define LDAP_OPT_SUCCESS        0
..
#define LDAP_SUCCESS                            0x00
#define LDAP_OPERATIONS_ERROR           0x01
#define LDAP_PROTOCOL_ERROR                     0x02
#define LDAP_TIMELIMIT_EXCEEDED         0x03
#define LDAP_SIZELIMIT_EXCEEDED         0x04
#define LDAP_COMPARE_FALSE                      0x05
...
#define LDAP_LOOP_DETECT                        0x36
#define LDAP_UPDATE_ERROR(n)    LDAP_RANGE((n),0x40,0x47) /* 64-69,71 */
#define LDAP_NAMING_VIOLATION           0x40
...
#define LDAP_MOD_ADD            (0x0000)
#define LDAP_MOD_DELETE         (0x0001)
#define LDAP_MOD_REPLACE        (0x0002)
#define LDAP_MOD_BVALUES        (0x0080)


More information about the Haskell-Cafe mailing list