os/ossrv/ossrv_pub/boost_apis/boost/python/module_init.hpp
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
sl@0
     1
// Copyright David Abrahams 2002.
sl@0
     2
// Distributed under the Boost Software License, Version 1.0. (See
sl@0
     3
// accompanying file LICENSE_1_0.txt or copy at
sl@0
     4
// http://www.boost.org/LICENSE_1_0.txt)
sl@0
     5
#ifndef MODULE_INIT_DWA20020722_HPP
sl@0
     6
# define MODULE_INIT_DWA20020722_HPP
sl@0
     7
sl@0
     8
# include <boost/python/detail/prefix.hpp>
sl@0
     9
sl@0
    10
# ifndef BOOST_PYTHON_MODULE_INIT
sl@0
    11
sl@0
    12
namespace boost { namespace python { namespace detail {
sl@0
    13
sl@0
    14
BOOST_PYTHON_DECL void init_module(char const* name, void(*)());
sl@0
    15
sl@0
    16
}}}
sl@0
    17
sl@0
    18
#  if (defined(_WIN32) || defined(__CYGWIN__)) && !defined(BOOST_PYTHON_STATIC_MODULE)
sl@0
    19
sl@0
    20
#   define BOOST_PYTHON_MODULE_INIT(name)               \
sl@0
    21
void init_module_##name();                              \
sl@0
    22
extern "C" __declspec(dllexport) void init##name()      \
sl@0
    23
{                                                       \
sl@0
    24
    boost::python::detail::init_module(                 \
sl@0
    25
        #name,&init_module_##name);                     \
sl@0
    26
}                                                       \
sl@0
    27
void init_module_##name()
sl@0
    28
sl@0
    29
#  elif defined(_AIX) && !defined(BOOST_PYTHON_STATIC_MODULE)
sl@0
    30
sl@0
    31
#   include <boost/python/detail/aix_init_module.hpp>
sl@0
    32
#   define BOOST_PYTHON_MODULE_INIT(name)                               \
sl@0
    33
void init_module_##name();                                              \
sl@0
    34
extern "C"                                                              \
sl@0
    35
{                                                                       \
sl@0
    36
    extern PyObject* _PyImport_LoadDynamicModule(char*, char*, FILE *); \
sl@0
    37
    void init##name()                                                   \
sl@0
    38
    {                                                                   \
sl@0
    39
        boost::python::detail::aix_init_module(                         \
sl@0
    40
            _PyImport_LoadDynamicModule, #name, &init_module_##name);   \
sl@0
    41
    }                                                                   \
sl@0
    42
}                                                                       \
sl@0
    43
void init_module_##name()
sl@0
    44
sl@0
    45
# elif BOOST_PYTHON_USE_GCC_SYMBOL_VISIBILITY
sl@0
    46
sl@0
    47
#   define BOOST_PYTHON_MODULE_INIT(name)                               \
sl@0
    48
void init_module_##name();                                              \
sl@0
    49
extern "C" __attribute__ ((visibility("default"))) void init##name()    \
sl@0
    50
{                                                                       \
sl@0
    51
    boost::python::detail::init_module(#name, &init_module_##name);     \
sl@0
    52
}                                                                       \
sl@0
    53
void init_module_##name()
sl@0
    54
sl@0
    55
# else
sl@0
    56
sl@0
    57
#   define BOOST_PYTHON_MODULE_INIT(name)                               \
sl@0
    58
void init_module_##name();                                              \
sl@0
    59
extern "C"  void init##name()                                           \
sl@0
    60
{                                                                       \
sl@0
    61
    boost::python::detail::init_module(#name, &init_module_##name);     \
sl@0
    62
}                                                                       \
sl@0
    63
void init_module_##name()
sl@0
    64
sl@0
    65
#  endif
sl@0
    66
sl@0
    67
# endif 
sl@0
    68
sl@0
    69
#endif // MODULE_INIT_DWA20020722_HPP