3 * Copyright 1998-2001 The OpenLDAP Foundation, Redwood City, California, USA
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted only as authorized by the OpenLDAP
8 * Public License. A copy of this license is available at
9 * http://www.OpenLDAP.org/license.html or in file LICENSE in the
10 * top-level directory of the distribution.
17 #if defined(__cplusplus) || defined(c_plusplus)
18 # define LDAP_BEGIN_DECL extern "C" {
19 # define LDAP_END_DECL }
21 # define LDAP_BEGIN_DECL /* begin declarations */
22 # define LDAP_END_DECL /* end declarations */
25 #if !defined(LDAP_NO_PROTOTYPES) && ( defined(LDAP_NEEDS_PROTOTYPES) || \
26 defined(__STDC__) || defined(__cplusplus) || defined(c_plusplus) )
29 # define LDAP_P(protos) protos
30 # define LDAP_CONCAT1(x,y) x ## y
31 # define LDAP_CONCAT(x,y) LDAP_CONCAT1(x,y)
32 # define LDAP_STRING(x) #x /* stringify without expanding x */
33 # define LDAP_XSTRING(x) LDAP_STRING(x) /* expand x, then stringify */
36 # define LDAP_CONST const
39 #else /* no prototypes */
42 # define LDAP_P(protos) ()
43 # define LDAP_CONCAT(x,y) x/**/y
44 # define LDAP_STRING(x) "x"
47 # define LDAP_CONST /* no const */
50 #endif /* no prototypes */
52 #if (__GNUC__) * 1000 + (__GNUC_MINOR__) >= 2006
53 # define LDAP_GCCATTR(attrs) __attribute__(attrs)
55 # define LDAP_GCCATTR(attrs)
59 /* Support for NT dynamic libraries. */
62 #if defined(LBER_DECL) && defined(_WIN32)
63 # define LBER_F(type) extern __declspec(LBER_DECL) type
64 # define LBER_V(type) extern __declspec(LBER_DECL) type
66 # define LBER_F(type) extern type
67 # define LBER_V(type) extern type
71 #if defined(LDAP_DECL) && defined(_WIN32)
72 # define LDAP_F(type) extern __declspec(LDAP_DECL) type
73 # define LDAP_V(type) extern __declspec(LDAP_DECL) type
75 # define LDAP_F(type) extern type
76 # define LDAP_V(type) extern type
80 * C library. Mingw32 links with the C run-time library by default,
81 * so the explicit definition of CSTATIC will keep dllimport from
84 #if (defined(__MINGW32__) && !defined(CSTATIC) || \
85 defined(_WIN32) && defined(_DLL))
86 # define LDAP_LIBC_F(type) extern __declspec(dllimport) type
87 # define LDAP_LIBC_V(type) extern __declspec(dllimport) type
89 # define LDAP_LIBC_F(type) extern type
90 # define LDAP_LIBC_V(type) extern type
94 #if defined(LDAP_AVL_DECL) && defined(_WIN32)
95 # define LDAP_AVL_F(type) extern __declspec(LDAP_AVL_DECL) type
96 # define LDAP_AVL_V(type) extern __declspec(LDAP_AVL_DECL) type
98 # define LDAP_AVL_F(type) extern type
99 # define LDAP_AVL_V(type) extern type
103 #if defined(LDAP_LDBM_DECL) && defined(_WIN32)
104 # define LDAP_LDBM_F(type) extern __declspec(LDAP_LDBM_DECL) type
105 # define LDAP_LDBM_V(type) extern __declspec(LDAP_LDBM_DECL) type
107 # define LDAP_LDBM_F(type) extern type
108 # define LDAP_LDBM_V(type) extern type
112 #if defined(LDAP_LDIF_DECL) && defined(_WIN32)
113 # define LDAP_LDIF_F(type) extern __declspec(LDAP_LDIF_DECL) type
114 # define LDAP_LDIF_V(type) extern __declspec(LDAP_LDIF_DECL) type
116 # define LDAP_LDIF_F(type) extern type
117 # define LDAP_LDIF_V(type) extern type
120 /* LUNICODE library */
121 #if defined(LDAP_LUNICODE_DECL) && defined(_WIN32)
122 # define LDAP_LUNICODE_F(type) extern __declspec(LDAP_LUNICODE_DECL) type
123 # define LDAP_LUNICODE_V(type) extern __declspec(LDAP_LUNICODE_DECL) type
125 # define LDAP_LUNICODE_F(type) extern type
126 # define LDAP_LUNICODE_V(type) extern type
130 #if defined(LDAP_LUTIL_DECL) && defined(_WIN32)
131 # define LDAP_LUTIL_F(type) extern __declspec(LDAP_LUTIL_DECL) type
132 # define LDAP_LUTIL_V(type) extern __declspec(LDAP_LUTIL_DECL) type
134 # define LDAP_LUTIL_F(type) extern type
135 # define LDAP_LUTIL_V(type) extern type
138 /* SLAPD (as a module exporting symbols) */
139 #if defined(LDAP_SLAPD_DECL) && defined(_WIN32)
140 # define LDAP_SLAPD_F(type) extern __declspec(LDAP_SLAPD_DECL) type
141 # define LDAP_SLAPD_V(type) extern __declspec(LDAP_SLAPD_DECL) type
143 # define LDAP_SLAPD_F(type) extern type
144 # define LDAP_SLAPD_V(type) extern type
147 #endif /* _LDAP_CDEFS_H */