]> git.sur5r.net Git - openldap/blob - include/ldap_cdefs.h
Add LDAP_CONST macro for use within EXTERNAL headers such as
[openldap] / include / ldap_cdefs.h
1 /*
2  * Copyright 1998,1999 The OpenLDAP Foundation, Redwood City, California, USA
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms are permitted only
6  * as authorized by the OpenLDAP Public License.  A copy of this
7  * license is available at http://www.OpenLDAP.org/license.html or
8  * in file LICENSE in the top-level directory of the distribution.
9  */
10 /* LDAP C Defines */
11
12 #ifndef _LDAP_CDEFS_H
13 #define _LDAP_CDEFS_H
14
15 #if defined(__cplusplus)
16 #       define LDAP_BEGIN_DECL  extern "C" {
17 #       define LDAP_END_DECL    }
18 #else
19 #       define LDAP_BEGIN_DECL  /* begin declarations */
20 #       define LDAP_END_DECL    /* end declarations */
21 #endif
22
23 #if !defined(__NO_PROTOTYPES) && ( \
24         defined(__STDC__) || defined(__cplusplus) || \
25         defined(__NEED_PROTOTYPES) )
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
52 #ifndef LDAP_F
53 #       ifdef _WIN32
54 #               define LDAP_F   __declspec( dllexport )
55 #       else /* ! _WIN32 */
56 #               define LDAP_F   extern
57 #       endif /* _WIN32 */
58 #endif /* LDAP_FDECL */
59
60 #endif /* _LDAP_CDEFS_H */