Mercurial > hg > vamp-build-and-test
comparison DEPENDENCIES/generic/include/boost/python/module_init.hpp @ 16:2665513ce2d3
Add boost headers
author | Chris Cannam |
---|---|
date | Tue, 05 Aug 2014 11:11:38 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
15:663ca0da4350 | 16:2665513ce2d3 |
---|---|
1 // Copyright David Abrahams 2002. | |
2 // Distributed under the Boost Software License, Version 1.0. (See | |
3 // accompanying file LICENSE_1_0.txt or copy at | |
4 // http://www.boost.org/LICENSE_1_0.txt) | |
5 #ifndef MODULE_INIT_DWA20020722_HPP | |
6 # define MODULE_INIT_DWA20020722_HPP | |
7 | |
8 # include <boost/python/detail/prefix.hpp> | |
9 # include <boost/preprocessor/cat.hpp> | |
10 # include <boost/preprocessor/stringize.hpp> | |
11 | |
12 # ifndef BOOST_PYTHON_MODULE_INIT | |
13 | |
14 namespace boost { namespace python { namespace detail { | |
15 | |
16 # if PY_VERSION_HEX >= 0x03000000 | |
17 | |
18 BOOST_PYTHON_DECL PyObject* init_module(PyModuleDef&, void(*)()); | |
19 | |
20 #else | |
21 | |
22 BOOST_PYTHON_DECL PyObject* init_module(char const* name, void(*)()); | |
23 | |
24 #endif | |
25 | |
26 }}} | |
27 | |
28 # if PY_VERSION_HEX >= 0x03000000 | |
29 | |
30 # define _BOOST_PYTHON_MODULE_INIT(name) \ | |
31 PyObject* BOOST_PP_CAT(PyInit_, name)() \ | |
32 { \ | |
33 static PyModuleDef_Base initial_m_base = { \ | |
34 PyObject_HEAD_INIT(NULL) \ | |
35 0, /* m_init */ \ | |
36 0, /* m_index */ \ | |
37 0 /* m_copy */ }; \ | |
38 static PyMethodDef initial_methods[] = { { 0, 0, 0, 0 } }; \ | |
39 \ | |
40 static struct PyModuleDef moduledef = { \ | |
41 initial_m_base, \ | |
42 BOOST_PP_STRINGIZE(name), \ | |
43 0, /* m_doc */ \ | |
44 -1, /* m_size */ \ | |
45 initial_methods, \ | |
46 0, /* m_reload */ \ | |
47 0, /* m_traverse */ \ | |
48 0, /* m_clear */ \ | |
49 0, /* m_free */ \ | |
50 }; \ | |
51 \ | |
52 return boost::python::detail::init_module( \ | |
53 moduledef, BOOST_PP_CAT(init_module_, name) ); \ | |
54 } \ | |
55 void BOOST_PP_CAT(init_module_, name)() | |
56 | |
57 # else | |
58 | |
59 # define _BOOST_PYTHON_MODULE_INIT(name) \ | |
60 void BOOST_PP_CAT(init,name)() \ | |
61 { \ | |
62 boost::python::detail::init_module( \ | |
63 BOOST_PP_STRINGIZE(name),&BOOST_PP_CAT(init_module_,name)); \ | |
64 } \ | |
65 void BOOST_PP_CAT(init_module_,name)() | |
66 | |
67 # endif | |
68 | |
69 # if (defined(_WIN32) || defined(__CYGWIN__)) && !defined(BOOST_PYTHON_STATIC_MODULE) | |
70 | |
71 # define BOOST_PYTHON_MODULE_INIT(name) \ | |
72 void BOOST_PP_CAT(init_module_,name)(); \ | |
73 extern "C" __declspec(dllexport) _BOOST_PYTHON_MODULE_INIT(name) | |
74 | |
75 # elif BOOST_PYTHON_USE_GCC_SYMBOL_VISIBILITY | |
76 | |
77 # define BOOST_PYTHON_MODULE_INIT(name) \ | |
78 void BOOST_PP_CAT(init_module_,name)(); \ | |
79 extern "C" __attribute__ ((__visibility__("default"))) _BOOST_PYTHON_MODULE_INIT(name) | |
80 | |
81 # else | |
82 | |
83 # define BOOST_PYTHON_MODULE_INIT(name) \ | |
84 void BOOST_PP_CAT(init_module_,name)(); \ | |
85 extern "C" _BOOST_PYTHON_MODULE_INIT(name) | |
86 | |
87 # endif | |
88 | |
89 # endif | |
90 | |
91 #endif // MODULE_INIT_DWA20020722_HPP |