2
0
mirror of https://github.com/boostorg/python.git synced 2026-01-24 18:12:43 +00:00

Integrating Andreas Zieringer's shared library implementation.

Modified Files:
	classes.hpp conversions.hpp cross_module.hpp errors.hpp
	module_builder.hpp objects.hpp operators.hpp detail/config.hpp
	detail/extension_class.hpp detail/functions.hpp
	detail/init_function.hpp detail/signatures.hpp
	detail/singleton.hpp detail/types.hpp detail/void_adaptor.hpp


[SVN r12083]
This commit is contained in:
Dave Abrahams
2001-12-17 16:59:54 +00:00
parent 291c36df05
commit 1a13387012
8 changed files with 84 additions and 20 deletions

View File

@@ -65,4 +65,68 @@
# endif
# endif
/*****************************************************************************
*
* Set up dll import/export options:
*
****************************************************************************/
// backwards compatibility:
#ifdef BOOST_RE_STATIC_LIB
# define BOOST_PYTHON_STATIC_LINK
#endif
#if defined(BOOST_MSVC) && defined(_DLL)
# define BOOST_PYTHON_HAS_DLL_RUNTIME
#endif
#if defined(__BORLANDC__) && defined(_RTLDLL)
# define BOOST_PYTHON_HAS_DLL_RUNTIME
#endif
#if defined(__ICL) && defined(_DLL)
# define BOOST_PYTHON_HAS_DLL_RUNTIME
#endif
#if defined(BOOST_PYTHON_HAS_DLL_RUNTIME) && !defined(BOOST_PYTHON_STATIC_LINK)
# if defined(BOOST_PYTHON_SOURCE)
# define BOOST_PYTHON_DECL __declspec(dllexport)
# define BOOST_PYTHON_BUILD_DLL
# else
# define BOOST_PYTHON_DECL __declspec(dllimport)
# endif
#endif
#ifndef BOOST_PYTHON_DECL
# define BOOST_PYTHON_DECL
#endif
#if (defined(BOOST_MSVC) || defined(__BORLANDC__)) && !defined(BOOST_PYTHON_NO_LIB) && !defined(BOOST_PYTHON_SOURCE)
# include <boost/python/detail/python_library_include.hpp>
#endif
// Borland C++ Fix/error check:
#if defined(__BORLANDC__)
# if (__BORLANDC__ == 0x550) || (__BORLANDC__ == 0x551)
// problems with std::basic_string and dll RTL:
# if defined(_RTLDLL) && defined(_RWSTD_COMPILE_INSTANTIATE)
# ifdef BOOST_PYTHON_BUILD_DLL
# error _RWSTD_COMPILE_INSTANTIATE must not be defined when building regex++ as a DLL
# else
# pragma warn defining _RWSTD_COMPILE_INSTANTIATE when linking to the DLL version of the RTL may produce memory corruption problems in std::basic_string, as a result of separate versions of basic_string's static data in the RTL and you're exe/dll: be warned!!
# endif
# endif
# ifndef _RTLDLL
// this is harmless for a staic link:
# define _RWSTD_COMPILE_INSTANTIATE
# endif
# endif
//
// VCL support:
// if we're building a console app then there can't be any VCL (can there?)
# if !defined(__CONSOLE__) && !defined(_NO_VCL)
# define BOOST_PYTHON_USE_VCL
# endif
#endif
#endif // CONFIG_DWA052200_H_

View File

@@ -52,12 +52,12 @@ template <class Specified> struct operand_select;
template <long> struct choose_unary_op;
template <long> struct define_operator;
meta_class<extension_instance>* extension_meta_class();
extension_instance* get_extension_instance(PyObject* p);
void report_missing_instance_data(extension_instance*, class_t<extension_instance>*, const std::type_info&);
void report_missing_ptr_data(extension_instance*, class_t<extension_instance>*, const std::type_info&);
void report_missing_class_object(const std::type_info&);
void report_released_smart_pointer(const std::type_info&);
BOOST_PYTHON_DECL meta_class<extension_instance>* extension_meta_class();
BOOST_PYTHON_DECL extension_instance* get_extension_instance(PyObject* p);
BOOST_PYTHON_DECL void report_missing_instance_data(extension_instance*, class_t<extension_instance>*, const std::type_info&);
BOOST_PYTHON_DECL void report_missing_ptr_data(extension_instance*, class_t<extension_instance>*, const std::type_info&);
BOOST_PYTHON_DECL void report_missing_class_object(const std::type_info&);
BOOST_PYTHON_DECL void report_released_smart_pointer(const std::type_info&);
template <class T>
T* check_non_null(T* p)
@@ -71,7 +71,7 @@ template <class Held> class held_instance;
typedef void* (*conversion_function_ptr)(void*);
struct base_class_info
struct BOOST_PYTHON_DECL base_class_info
{
base_class_info(extension_class_base* t, conversion_function_ptr f)
:class_object(t), convert(f)
@@ -85,7 +85,7 @@ typedef base_class_info derived_class_info;
struct add_operator_base;
class extension_class_base : public class_t<extension_instance>
class BOOST_PYTHON_DECL extension_class_base : public class_t<extension_instance>
{
public:
extension_class_base(const char* name);
@@ -378,7 +378,7 @@ namespace detail {
template <class T> class instance_holder;
class read_only_setattr_function : public function
class BOOST_PYTHON_DECL read_only_setattr_function : public function
{
public:
read_only_setattr_function(const char* name);
@@ -725,7 +725,7 @@ public:
// Abstract base class for all obj holders. Base for template class
// instance_holder<>, below.
class instance_holder_base
class BOOST_PYTHON_DECL instance_holder_base
{
public:
virtual ~instance_holder_base() {}
@@ -813,7 +813,7 @@ class instance_ptr_holder : public instance_holder<HeldType>
PtrType m_ptr;
};
class extension_instance : public instance
class BOOST_PYTHON_DECL extension_instance : public instance
{
public:
extension_instance(PyTypeObject* class_);

View File

@@ -29,7 +29,7 @@ class extension_instance;
// function --
// the common base class for all overloadable function and method objects
// supplied by the library.
class function : public python_object
class BOOST_PYTHON_DECL function : public python_object
{
public:
function();
@@ -201,7 +201,7 @@ inline function* new_virtual_function(
// the expression a.b where a is an instance or extension_instance object and b
// is a callable object not found in the obj namespace but on its class or
// a base class.
class bound_function : public python_object
class BOOST_PYTHON_DECL bound_function : public python_object
{
public:
static bound_function* create(const ref& target, const ref& fn);

View File

@@ -230,7 +230,7 @@ struct init_function
}
};
class init : public function
class BOOST_PYTHON_DECL init : public function
{
private: // override function hook
PyObject* do_call(PyObject* args, PyObject* keywords) const;

View File

@@ -17,7 +17,7 @@ namespace boost { namespace python {
namespace detail {
// A stand-in for the built-in void. This one can be passed to functions and
// (under MSVC, which has a bug, be used as a default template type parameter).
struct void_t {};
struct BOOST_PYTHON_DECL void_t {};
}
// An envelope in which type information can be delivered for the purposes

View File

@@ -13,7 +13,7 @@
namespace boost { namespace python { namespace detail {
struct empty {};
struct BOOST_PYTHON_DECL empty {};
template <class Derived, class Base = empty>
struct singleton : Base
{

View File

@@ -37,7 +37,7 @@ namespace detail {
class instance_holder_base;
class type_object_base : public python_type
class BOOST_PYTHON_DECL type_object_base : public python_type
{
public:
explicit type_object_base(PyTypeObject* type_type);
@@ -327,7 +327,7 @@ PyObject* reprable<Base>::instance_repr(PyObject* obj) const
// memory. Reference counting is used to free unused memory.
// This is useful because method tables of related extension classes tend
// to be identical, so less memory is needed for them.
class shared_pod_manager
class BOOST_PYTHON_DECL shared_pod_manager
{
typedef std::pair<char*, std::size_t> holder;
typedef std::vector<holder> storage;
@@ -394,7 +394,7 @@ PyObject* reprable<Base>::instance_repr(PyObject* obj) const
};
void add_capability(type_object_base::capability capability,
BOOST_PYTHON_DECL void add_capability(type_object_base::capability capability,
PyTypeObject* dest);
// This macro gets the length of an array as a compile-time constant, and will

View File

@@ -8,7 +8,7 @@
namespace boost { namespace python { namespace detail {
extern PyObject arbitrary_object;
BOOST_PYTHON_DECL extern PyObject arbitrary_object;
template <class T>
struct void_adaptor