os/ossrv/ossrv_pub/boost_apis/boost/python/module_init.hpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     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 
    12 namespace boost { namespace python { namespace detail {
    13 
    14 BOOST_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)               \
    21 void init_module_##name();                              \
    22 extern "C" __declspec(dllexport) void init##name()      \
    23 {                                                       \
    24     boost::python::detail::init_module(                 \
    25         #name,&init_module_##name);                     \
    26 }                                                       \
    27 void 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)                               \
    33 void init_module_##name();                                              \
    34 extern "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 }                                                                       \
    43 void init_module_##name()
    44 
    45 # elif BOOST_PYTHON_USE_GCC_SYMBOL_VISIBILITY
    46 
    47 #   define BOOST_PYTHON_MODULE_INIT(name)                               \
    48 void init_module_##name();                                              \
    49 extern "C" __attribute__ ((visibility("default"))) void init##name()    \
    50 {                                                                       \
    51     boost::python::detail::init_module(#name, &init_module_##name);     \
    52 }                                                                       \
    53 void init_module_##name()
    54 
    55 # else
    56 
    57 #   define BOOST_PYTHON_MODULE_INIT(name)                               \
    58 void init_module_##name();                                              \
    59 extern "C"  void init##name()                                           \
    60 {                                                                       \
    61     boost::python::detail::init_module(#name, &init_module_##name);     \
    62 }                                                                       \
    63 void init_module_##name()
    64 
    65 #  endif
    66 
    67 # endif 
    68 
    69 #endif // MODULE_INIT_DWA20020722_HPP