3 * Copyright 1998-2000 The OpenLDAP Foundation, Redwood City, California, USA
6 * Redistribution and use in source and binary forms are permitted only
7 * as authorized by the OpenLDAP Public License. A copy of this
8 * license is available at http://www.OpenLDAP.org/license.html or
9 * in file LICENSE in the top-level directory of the distribution.
16 #if defined(__cplusplus) || defined(c_plusplus)
17 # define LDAP_BEGIN_DECL extern "C" {
18 # define LDAP_END_DECL }
20 # define LDAP_BEGIN_DECL /* begin declarations */
21 # define LDAP_END_DECL /* end declarations */
24 #if !defined(LDAP_NO_PROTOTYPES) && ( defined(LDAP_NEEDS_PROTOTYPES) || \
25 defined(__STDC__) || defined(__cplusplus) || defined(c_plusplus) )
28 # define LDAP_P(protos) protos
29 # define LDAP_CONCAT1(x,y) x ## y
30 # define LDAP_CONCAT(x,y) LDAP_CONCAT1(x,y)
31 # define LDAP_STRING(x) #x /* stringify without expanding x */
32 # define LDAP_XSTRING(x) LDAP_STRING(x) /* expand x, then stringify */
35 # define LDAP_CONST const
38 #else /* no prototypes */
41 # define LDAP_P(protos) ()
42 # define LDAP_CONCAT(x,y) x/**/y
43 # define LDAP_STRING(x) "x"
46 # define LDAP_CONST /* no const */
49 #endif /* no prototypes */
51 #if (__GNUC__) * 1000 + (__GNUC_MINOR__) >= 2006
52 # define LDAP_GCCATTR(attrs) __attribute__(attrs)
54 # define LDAP_GCCATTR(attrs)
58 /* Support for NT dynamic libraries. */
61 #if defined(LBER_DECL) && defined(_WIN32)
62 # define LBER_F(type) extern __declspec(LBER_DECL) type
64 # define LBER_F(type) type
68 #if defined(LDAP_DECL) && defined(_WIN32)
69 # define LDAP_F(type) extern __declspec(LDAP_DECL) type
71 # define LDAP_F(type) extern type
75 * C library. Mingw32 links with the C run-time library by default,
76 * so the explicit definition of CSTATIC will keep dllimport from
79 #if (defined(__MINGW32__) && !defined(CSTATIC) || \
80 defined(_WIN32) && defined(_DLL))
81 # define LDAP_LIBC_F(type) extern __declspec(dllimport) type
83 # define LDAP_LIBC_F(type) extern type
87 #if defined(LDAP_AVL_DECL) && defined(_WIN32)
88 # define LDAP_AVL_F(type) extern __declspec(LDAP_AVL_DECL) type
90 # define LDAP_AVL_F(type) extern type
94 #if defined(LDAP_LDBM_DECL) && defined(_WIN32)
95 # define LDAP_LDBM_F(type) extern __declspec(LDAP_LDBM_DECL) type
97 # define LDAP_LDBM_F(type) extern type
101 #if defined(LDAP_LDIF_DECL) && defined(_WIN32)
102 # define LDAP_LDIF_F(type) extern __declspec(LDAP_LDIF_DECL) type
104 # define LDAP_LDIF_F(type) extern type
107 /* LUNICODE library */
108 #if defined(LDAP_LUNICODE_DECL) && defined(_WIN32)
109 # define LDAP_LUNICODE_F(type) extern __declspec(LDAP_LUNICODE_DECL) type
111 # define LDAP_LUNICODE_F(type) extern type
115 #if defined(LDAP_LUTIL_DECL) && defined(_WIN32)
116 # define LDAP_LUTIL_F(type) extern __declspec(LDAP_LUTIL_DECL) type
118 # define LDAP_LUTIL_F(type) extern type
121 /* SLAPD (as a module exporting symbols) */
122 #if defined(LDAP_SLAPD_DECL) && defined(_WIN32)
123 # define LDAP_SLAPD_F(type) extern __declspec(LDAP_SLAPD_DECL) type
125 # define LDAP_SLAPD_F(type) extern type
128 #endif /* _LDAP_CDEFS_H */