diff --git a/build/Jamfile.v2 b/build/Jamfile.v2 index bcce306b..c236ba6d 100644 --- a/build/Jamfile.v2 +++ b/build/Jamfile.v2 @@ -38,7 +38,6 @@ lib boost_python str.cpp slice.cpp - aix_init_module.cpp converter/from_python.cpp converter/registry.cpp converter/type_id.cpp diff --git a/build/VisualStudio/boost_python.dsp b/build/VisualStudio/boost_python.dsp index b05e91bf..336a4f73 100644 --- a/build/VisualStudio/boost_python.dsp +++ b/build/VisualStudio/boost_python.dsp @@ -95,10 +95,6 @@ LINK32=link.exe # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" # Begin Source File -SOURCE=..\..\src\aix_init_module.cpp -# End Source File -# Begin Source File - SOURCE=..\..\src\converter\arg_to_python_base.cpp # End Source File # Begin Source File @@ -214,10 +210,6 @@ SOURCE=..\..\src\exec.cpp # PROP Default_Filter "" # Begin Source File -SOURCE=..\..\..\..\boost\python\detail\aix_init_module.hpp -# End Source File -# Begin Source File - SOURCE=..\..\..\..\boost\python\detail\api_placeholder.hpp # End Source File # Begin Source File diff --git a/src/aix_init_module.cpp b/src/aix_init_module.cpp deleted file mode 100644 index 48ccc2c7..00000000 --- a/src/aix_init_module.cpp +++ /dev/null @@ -1,141 +0,0 @@ -// Copyright David Abrahams 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifdef _AIX -#include -#include - -extern "C" -{ -#include -#include -} - -# include -# include -# include -# include -# include - -namespace boost { namespace python { namespace detail { - -namespace -{ - static PyMethodDef initial_methods[] = { { 0, 0, 0, 0 } }; - extern "C" void initlibboost_python() - { - Py_InitModule("libboost_python", initial_methods); - } - - struct find_and_open_file - { - FILE* fp; - std::string libpath; // -- search path - std::string filename; // -- filename to look for - std::string fullpath; // -- full path to file - - find_and_open_file( - const std::string& libpath_env - , const std::string& file); - }; - - find_and_open_file::find_and_open_file( - const std::string& libpath_env - , const std::string& file) - : fp(0) - { - char* value = std::getenv(libpath_env.c_str()); - - if(value == 0) - return; - - libpath = value; - - if (libpath == "") - return; - - std::string::size_type pos = 0, prev_pos = 0; - - // -- loop through all search paths looking for file - while((pos = libpath.find_first_of(":",pos)) != std::string::npos) - { - fullpath = libpath.substr(prev_pos,pos - prev_pos) + "/" + file; - if (::access(fullpath.c_str(), R_OK) == 0) - { - struct stat filestat; - ::stat(fullpath.c_str(), &filestat); - if (!S_ISDIR(filestat.st_mode)) - { - fp = std::fopen(fullpath.c_str(), "r"); - if (fp) - { - filename = file; - } - return; - } - } - prev_pos = ++pos; - } - - // -- mop up odd path - if (libpath.find_first_of(":", prev_pos) == std::string::npos) - { - fullpath = libpath.substr(prev_pos, libpath.size() - prev_pos) + "/" + file; - if (::access(fullpath.c_str(), R_OK) == 0) - { - struct stat filestat; - ::stat(fullpath.c_str(),&filestat); - if (!S_ISDIR(filestat.st_mode)) - { - fp = std::fopen(fullpath.c_str(), "r"); - filename = file; - } - } - } - } -} - -void aix_init_module( - so_load_function load_dynamic_module - , char const* module_name - , void (*init_module)()) -{ - static bool initialized; - if (!initialized) - { - char const* const name = "libboost_python.so"; - find_and_open_file dynlib("LIBPATH", name); - if (dynlib.fp == 0) - { - fprintf(stderr, " Error: could not find %s\n", name); - return; - } - - std::string::size_type pos = pos = dynlib.filename.rfind(".so"); - if (pos != dynlib.filename.size() - 3) - { - fprintf(stderr, "dynamic library %s must end with .so\n", dynlib.filename.c_str()); - return; - } - - PyObject* m = - load_dynamic_module( - const_cast(dynlib.filename.substr(0,pos).c_str()), - const_cast(dynlib.fullpath.c_str()), - dynlib.fp); - - if (m == 0) - { - fprintf(stderr, "failed to load library %s\n", name); - return; - } - Py_DECREF(m); - - initialized = true; - } - python::detail::init_module(module_name, init_module); -} - -}}} // namespace boost::python -#endif