Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_34_1/libs/python/src/import.cpp @ 29

Last change on this file since 29 was 29, checked in by landauf, 16 years ago

updated boost from 1_33_1 to 1_34_1

File size: 683 bytes
Line 
1// Copyright Stefan Seefeld 2005.
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
6#include <boost/python/import.hpp>
7#include <boost/python/borrowed.hpp>
8#include <boost/python/extract.hpp>
9#include <boost/python/handle.hpp>
10
11namespace boost
12{ 
13namespace python
14{
15
16object BOOST_PYTHON_DECL import(str name)
17{
18  // should be 'char const *' but older python versions don't use 'const' yet.
19  char *n = python::extract<char *>(name);
20  python::handle<> module(PyImport_ImportModule(n));
21  return python::object(module);
22}
23
24}  // namespace boost::python
25}  // namespace boost
Note: See TracBrowser for help on using the repository browser.