]> git.sur5r.net Git - openldap/blob - include/ldap_cdefs.h
Remove old DLL IMPORT/EXPORT macros
[openldap] / include / ldap_cdefs.h
1 /* $OpenLDAP$ */
2 /*
3  * Copyright 1998,1999 The OpenLDAP Foundation, Redwood City, California, USA
4  * All rights reserved.
5  *
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.
10  */
11 /* LDAP C Defines */
12
13 #ifndef _LDAP_CDEFS_H
14 #define _LDAP_CDEFS_H
15
16 #if defined(__cplusplus) || defined(c_plusplus)
17 #       define LDAP_BEGIN_DECL  extern "C" {
18 #       define LDAP_END_DECL    }
19 #else
20 #       define LDAP_BEGIN_DECL  /* begin declarations */
21 #       define LDAP_END_DECL    /* end declarations */
22 #endif
23
24 #if !defined(__NO_PROTOTYPES) && ( defined(__NEED_PROTOTYPES) || \
25         defined(__STDC__) || defined(__cplusplus) || defined(c_plusplus) )
26
27         /* ANSI C or C++ */
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 */
33
34 #ifndef LDAP_CONST
35 #       define LDAP_CONST       const
36 #endif
37
38 #else /* no prototypes */
39
40         /* traditional C */
41 #       define LDAP_P(protos)   ()
42 #       define LDAP_CONCAT(x,y) x/**/y
43 #       define LDAP_STRING(x)   "x"
44
45 #ifndef LDAP_CONST
46 #       define LDAP_CONST       /* no const */
47 #endif
48
49 #endif /* no prototypes */
50
51 #if (__GNUC__) * 1000 + (__GNUC_MINOR__) >= 2006
52 #       define LDAP_GCCATTR(attrs)      __attribute__(attrs)
53 #else
54 #       define LDAP_GCCATTR(attrs)
55 #endif
56
57
58 /* Support for NT dynamic libraries. */
59
60 /*
61  * C library. Mingw32 links with the C run-time library by default,
62  * so the explicit definition of CSTATIC will keep dllimport from
63  * being defined.
64  */
65 #if (defined(__MINGW32__) && !defined(CSTATIC) || \
66      defined(_WIN32) && defined(_DLL))
67 #       define LIBC_F(type)     extern __declspec(dllimport) type
68 #else
69 #       define LIBC_F(type)     extern type
70 #endif
71
72 /* AVL library */
73 #if defined(LIBAVL_DECL) && defined(_WIN32)
74 #       define LIBAVL_F(type)   extern __declspec(LIBAVL_DECL) type
75 #else
76 #       define LIBAVL_F(type)   extern type
77 #endif
78
79 /* LBER library */
80 #if defined(LIBLBER_DECL) && defined(_WIN32)
81 #       define LIBLBER_F(type)  extern __declspec(LIBLBER_DECL) type
82 #else
83 #       define LIBLBER_F(type)  extern type
84 #endif
85
86 /* LDAP library */
87 #if defined(LIBLDAP_DECL) && defined(_WIN32)
88 #       define LIBLDAP_F(type)  extern __declspec(LIBLDAP_DECL) type
89 #else
90 #       define LIBLDAP_F(type)  extern type
91 #endif
92
93 /* LDBM library */
94 #if defined(LIBLDBM_DECL) && defined(_WIN32)
95 #       define LIBLDBM_F(type)  extern __declspec(LIBLDBM_DECL) type
96 #else
97 #       define LIBLDBM_F(type)  extern type
98 #endif
99
100 /* LDIF library */
101 #if defined(LIBLDIF_DECL) && defined(_WIN32)
102 #       define LIBLDIF_F(type)  extern __declspec(LIBLDIF_DECL) type
103 #else
104 #       define LIBLDIF_F(type)  extern type
105 #endif
106
107 /* LUTIL library */
108 #if defined(LIBLUTIL_DECL) && defined(_WIN32)
109 #       define LIBLUTIL_F(type) extern __declspec(LIBLUTIL_DECL) type
110 #else
111 #       define LIBLUTIL_F(type) extern type
112 #endif
113
114 /* SLAPD (as a module exporting symbols) */
115 #if defined(LIBSLAPD_DECL) && defined(_WIN32)
116 #       define LIBSLAPD_F(type) extern __declspec(LIBSLAPD_DECL) type
117 #else
118 #       define LIBSLAPD_F(type) extern type
119 #endif
120
121 #endif /* _LDAP_CDEFS_H */