source: NonGTP/Boost/boost/python/module_init.hpp @ 857

Revision 857, 3.0 KB checked in by igarcia, 18 years ago (diff)
Line 
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
10# ifndef BOOST_PYTHON_MODULE_INIT
11
12namespace boost { namespace python { namespace detail {
13
14BOOST_PYTHON_DECL void init_module(char const* name, void(*)());
15
16}}}
17
18#  if (defined(_WIN32) || defined(__CYGWIN__)) && !defined(BOOST_PYTHON_STATIC_MODULE)
19
20#   define BOOST_PYTHON_MODULE_INIT(name)               \
21void init_module_##name();                              \
22extern "C" __declspec(dllexport) void init##name()      \
23{                                                       \
24    boost::python::detail::init_module(                 \
25        #name,&init_module_##name);                     \
26}                                                       \
27void init_module_##name()
28
29#  elif defined(_AIX) && !defined(BOOST_PYTHON_STATIC_MODULE)
30
31#   include <boost/python/detail/aix_init_module.hpp>
32#   define BOOST_PYTHON_MODULE_INIT(name)                               \
33void init_module_##name();                                              \
34extern "C"                                                              \
35{                                                                       \
36    extern PyObject* _PyImport_LoadDynamicModule(char*, char*, FILE *); \
37    void init##name()                                                   \
38    {                                                                   \
39        boost::python::detail::aix_init_module(                         \
40            _PyImport_LoadDynamicModule, #name, &init_module_##name);   \
41    }                                                                   \
42}                                                                       \
43void init_module_##name()
44
45# elif BOOST_PYTHON_USE_GCC_SYMBOL_VISIBILITY
46
47#   define BOOST_PYTHON_MODULE_INIT(name)                               \
48void init_module_##name();                                              \
49extern "C" __attribute__ ((visibility("default"))) void init##name()    \
50{                                                                       \
51    boost::python::detail::init_module(#name, &init_module_##name);     \
52}                                                                       \
53void init_module_##name()
54
55# else
56
57#   define BOOST_PYTHON_MODULE_INIT(name)                               \
58void init_module_##name();                                              \
59extern "C"  void init##name()                                           \
60{                                                                       \
61    boost::python::detail::init_module(#name, &init_module_##name);     \
62}                                                                       \
63void init_module_##name()
64
65#  endif
66
67# endif
68
69#endif // MODULE_INIT_DWA20020722_HPP
Note: See TracBrowser for help on using the repository browser.