]> git.sur5r.net Git - openldap/blob - include/ldap_cdefs.h
Preliminary Make rules to allow building backends as modules.
[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) || defined(c_plusplus)
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) && ( defined(__NEED_PROTOTYPES) || \
24         defined(__STDC__) || defined(__cplusplus) || defined(c_plusplus) )
25
26         /* ANSI C or C++ */
27 #       define LDAP_P(protos)   protos
28 #       define LDAP_CONCAT1(x,y)        x ## y
29 #       define LDAP_CONCAT(x,y) LDAP_CONCAT1(x,y)
30 #       define LDAP_STRING(x)   #x /* stringify without expanding x */
31 #       define LDAP_XSTRING(x)  LDAP_STRING(x) /* expand x, then stringify */
32
33 #ifndef LDAP_CONST
34 #       define LDAP_CONST       const
35 #endif
36
37 #else /* no prototypes */
38
39         /* traditional C */
40 #       define LDAP_P(protos)   ()
41 #       define LDAP_CONCAT(x,y) x/**/y
42 #       define LDAP_STRING(x)   "x"
43
44 #ifndef LDAP_CONST
45 #       define LDAP_CONST       /* no const */
46 #endif
47
48 #endif /* no prototypes */
49
50 #if _WIN32 && _DLL
51 #       define LDAP_F_IMPORT    extern __declspec( dllimport )
52 #       define LDAP_F_EXPORT    extern __declspec( dllexport )
53 #else
54 #       define LDAP_F_IMPORT    extern
55 #       define LDAP_F_EXPORT    extern
56 #endif
57
58 #endif /* _LDAP_CDEFS_H */
59
60 /* purposely allow these to be redefined */
61 #ifndef LDAP_F_PRE
62 #       define LDAP_F_PRE       LDAP_F_IMPORT
63 #endif
64 #ifndef LDAP_F_POST
65 #       define LDAP_F_POST      /* no post */
66 #endif
67 #ifndef LDAP_F
68 #define LDAP_F(type)    LDAP_F_PRE type LDAP_F_POST
69 #endif
70