Added test for `object::operator()` of different
[luabind.git] / luabind / config.hpp
blob5001db1e6b063d871577a98bd600471b93209825
1 // Copyright (c) 2003 Daniel Wallin and Arvid Norberg
3 // Permission is hereby granted, free of charge, to any person obtaining a
4 // copy of this software and associated documentation files (the "Software"),
5 // to deal in the Software without restriction, including without limitation
6 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
7 // and/or sell copies of the Software, and to permit persons to whom the
8 // Software is furnished to do so, subject to the following conditions:
10 // The above copyright notice and this permission notice shall be included
11 // in all copies or substantial portions of the Software.
13 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
14 // ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
15 // TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
16 // PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
17 // SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
18 // ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
19 // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
21 // OR OTHER DEALINGS IN THE SOFTWARE.
24 #ifndef LUABIND_CONFIG_HPP_INCLUDED
25 #define LUABIND_CONFIG_HPP_INCLUDED
27 #include <boost/config.hpp>
29 #ifdef BOOST_MSVC
30 #define LUABIND_ANONYMOUS_FIX static
31 #else
32 #define LUABIND_ANONYMOUS_FIX
33 #endif
35 #if defined (BOOST_MSVC) && (BOOST_MSVC <= 1200)
37 #define for if (false) {} else for
39 #include <cstring>
41 namespace std
43 using ::strlen;
44 using ::strcmp;
45 using ::type_info;
48 #endif
51 #if defined (BOOST_MSVC) && (BOOST_MSVC <= 1300)
52 #define LUABIND_MSVC_TYPENAME
53 #else
54 #define LUABIND_MSVC_TYPENAME typename
55 #endif
57 // the maximum number of arguments of functions that's
58 // registered. Must at least be 2
59 #ifndef LUABIND_MAX_ARITY
60 #define LUABIND_MAX_ARITY 10
61 #elif LUABIND_MAX_ARITY <= 1
62 #undef LUABIND_MAX_ARITY
63 #define LUABIND_MAX_ARITY 2
64 #endif
66 // the maximum number of classes one class
67 // can derive from
68 // max bases must at least be 1
69 #ifndef LUABIND_MAX_BASES
70 #define LUABIND_MAX_BASES 4
71 #elif LUABIND_MAX_BASES <= 0
72 #undef LUABIND_MAX_BASES
73 #define LUABIND_MAX_BASES 1
74 #endif
76 // LUABIND_NO_ERROR_CHECKING
77 // define this to remove all error checks
78 // this will improve performance and memory
79 // footprint.
80 // if it is defined matchers will only be called on
81 // overloaded functions, functions that's
82 // not overloaded will be called directly. The
83 // parameters on the lua stack are assumed
84 // to match those of the function.
85 // exceptions will still be catched when there's
86 // no error checking.
88 // LUABIND_NOT_THREADSAFE
89 // this define will make luabind non-thread safe. That is,
90 // it will rely on a static variable. You can still have
91 // multiple lua states and use coroutines, but only
92 // one of your real threads may run lua code.
94 // If you don't want to use the rtti supplied by C++
95 // you can supply your own type-info structure with the
96 // LUABIND_TYPE_INFO define. Your type-info structure
97 // must be copyable and it must be able to compare itself
98 // against other type-info structures. You supply the compare
99 // function through the LUABIND_TYPE_INFO_EQUAL()
100 // define. It should compare the two type-info structures
101 // it is given and return true if they represent the same type
102 // and false otherwise. You also have to supply a function
103 // to generate your type-info structure. You do this through
104 // the LUABIND_TYPEID() define. It takes a type as it's
105 // parameter. That is, a compile time parameter. To use it
106 // you probably have to make a traits class with specializations
107 // for all classes that you have type-info for.
109 #ifndef LUABIND_TYPE_INFO
110 #define LUABIND_TYPE_INFO const std::type_info*
111 #define LUABIND_TYPEID(t) &typeid(t)
112 #define LUABIND_TYPE_INFO_EQUAL(i1, i2) *i1 == *i2
113 #define LUABIND_INVALID_TYPE_INFO &typeid(detail::null_type)
114 #include <typeinfo>
115 #endif
117 // LUABIND_NO_EXCEPTIONS
118 // this define will disable all usage of try, catch and throw in
119 // luabind. This will in many cases disable runtime-errors, such
120 // as invalid casts, when calling lua-functions that fails or
121 // returns values that cannot be converted by the given policy.
122 // Luabind requires that no function called directly or indirectly
123 // by luabind throws an exception (throwing exceptions through
124 // C code has undefined behavior, lua is written in C).
126 // LUABIND_EXPORT
127 // LUABIND_IMPORT
128 // If you're building luabind as a dll on windows with devstudio
129 // you can set LUABIND_EXPORT to __declspec(dllexport)
130 // and LUABIND_IMPORT to __declspec(dllimport)
132 #if _GNUC_ >= 4
133 #define LUABIND_API __attribute__ ((visibility("default")))
134 #else
136 // this define is set if we're currently building a luabind file
137 // select import or export depending on it
138 #ifdef LUABIND_BUILDING
139 #ifdef LUABIND_EXPORT
140 #define LUABIND_API LUABIND_EXPORT
141 #else
142 #define LUABIND_API
143 #endif
144 #else
145 #ifdef LUABIND_IMPORT
146 #define LUABIND_API LUABIND_IMPORT
147 #else
148 #define LUABIND_API
149 #endif
150 #endif
152 #endif
154 #endif // LUABIND_CONFIG_HPP_INCLUDED