Boost logo

Boost-Commit :

From: oryol_at_[hidden]
Date: 2008-07-25 20:04:36


Author: jeremypack
Date: 2008-07-25 20:04:36 EDT (Fri, 25 Jul 2008)
New Revision: 47824
URL: http://svn.boost.org/trac/boost/changeset/47824

Log:
Remove library name parameter from load_single_library (second version), and a macro for automatically placing a standard exported function signature, if desired.
Text files modified:
   sandbox/boost/extension/extension.hpp | 5 +++++
   sandbox/boost/extension/shared_library.hpp | 26 ++++++++++++++++++++++++++
   2 files changed, 31 insertions(+), 0 deletions(-)

Modified: sandbox/boost/extension/extension.hpp
==============================================================================
--- sandbox/boost/extension/extension.hpp (original)
+++ sandbox/boost/extension/extension.hpp 2008-07-25 20:04:36 EDT (Fri, 25 Jul 2008)
@@ -22,5 +22,10 @@
 #define BOOST_EXTENSION_EXPORT_DECL
 #else
 #include <boost/extension/impl/decl.hpp>
+#define BOOST_EXTENSION_TYPE_MAP_FUNCTION \
+extern "C" \
+void BOOST_EXTENSION_EXPORT_DECL \
+boost_extension_exported_type_map_function \
+ (boost::extensions::type_map& types)
 #endif // BOOST_EXTENSION_EXPORT_DECL
 #endif // BOOST_EXTENSION_EXTENSION_HPP

Modified: sandbox/boost/extension/shared_library.hpp
==============================================================================
--- sandbox/boost/extension/shared_library.hpp (original)
+++ sandbox/boost/extension/shared_library.hpp 2008-07-25 20:04:36 EDT (Fri, 25 Jul 2008)
@@ -23,6 +23,8 @@
 
 namespace boost {
 namespace extensions {
+template <class TypeInfo>
+class basic_type_map;
 
 /** \brief A wrapper around OS-specific shared library functions.
 
@@ -84,6 +86,30 @@
     return impl::close_shared_library(handle_);
   }
 
+ /** \brief Call a special Extension function in the library.
+ *
+ * There is a special function called
+ * boost_extension_exported_type_map_function which is commonly
+ * used by shared libraries. The call function attempts to find
+ * and call that function, given a type_map.
+ *
+ * \return true on success.
+ * \param types A type_map that will be sent to the function.
+ * \pre is_open() == true
+ * \post None.
+ */
+ template <class TypeInfo>
+ bool call(basic_type_map<TypeInfo>& types) {
+ void (*func)(basic_type_map<TypeInfo>&);
+ func = get<void, basic_type_map<TypeInfo>&>
+ ("boost_extension_exported_type_map_function");
+ if (func) {
+ (*func)(types);
+ return true;
+ } else {
+ return false;
+ }
+ }
 // If Doxygen is being run, use more readable definitions for the
 // documentation.
 #ifdef BOOST_EXTENSION_DOXYGEN_INVOKED


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk