[Libreoffice-commits] core.git: android/experimental cppuhelper/source include/osl ios/experimental ios/qa ios/shared sax/source stoc/source stoc/util

Stephan Bergmann sbergman at redhat.com
Wed Dec 18 23:55:05 PST 2013


 android/experimental/DocumentLoader/native-code.cxx      |   16 
 android/experimental/LibreOffice4Android/native-code.cxx |   16 
 android/experimental/desktop/native-code.cxx             |   16 
 cppuhelper/source/loadsharedlibcomponentfactory.hxx      |   19 
 cppuhelper/source/servicemanager.cxx                     |  156 ++-
 cppuhelper/source/servicemanager.hxx                     |   31 
 cppuhelper/source/shlib.cxx                              |  659 ++++++---------
 include/osl/detail/component-mapping.h                   |   39 
 ios/experimental/LibreOffice/LibreOffice/lo.mm           |   16 
 ios/experimental/TiledLibreOffice/TiledLibreOffice/lo.mm |   16 
 ios/qa/sc/filters-test.m                                 |    4 
 ios/shared/ios_sharedlo/cxx/mlo.mm                       |   16 
 sax/source/expatwrap/expwrap.component                   |   11 
 sax/source/expatwrap/sax_expat.cxx                       |   51 -
 sax/source/expatwrap/saxwriter.cxx                       |   52 -
 sax/source/fastparser/fastparser.cxx                     |   50 -
 stoc/source/defaultregistry/defaultregistry.cxx          |   46 -
 stoc/source/implementationregistration/implreg.cxx       |   42 
 stoc/source/loader/dllcomponentloader.cxx                |   51 -
 stoc/source/security/access_controller.cxx               |   40 
 stoc/source/security/file_policy.cxx                     |   37 
 stoc/source/servicemanager/servicemanager.cxx            |  115 --
 stoc/source/simpleregistry/simpleregistry.cxx            |   42 
 stoc/util/bootstrap.component                            |   29 
 24 files changed, 695 insertions(+), 875 deletions(-)

New commits:
commit ae3a0c8da50b36db395984637f5ad74d3b4887bc
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Thu Dec 19 08:48:56 2013 +0100

    Add .component <implementation constructor="..." feature
    
    ...to directly call constructor functions of ComponentContext-based C++
    implementations of (non-single-instance) UNO services.  The case where these
    calls would need to be bridged across different environments (e.g., from gcc3
    to gcc3:affine) is not yet implemented.
    
    bootstrap.component and expwrap.component are adapted accordingly as a proof-of-
    concept (which had previously been adapted to use the prefix="direct" feature,
    which may become unnecessary again in the end, depending on how to handle
    single-instance services/singletons).  More to follow.
    
    Change-Id: I18682d75bcd29d3d427e31331b4ce8161dbb846d

diff --git a/android/experimental/DocumentLoader/native-code.cxx b/android/experimental/DocumentLoader/native-code.cxx
index 43949ef..2eb7cce 100644
--- a/android/experimental/DocumentLoader/native-code.cxx
+++ b/android/experimental/DocumentLoader/native-code.cxx
@@ -11,11 +11,11 @@
 
 extern "C"
 __attribute__ ((visibility("default")))
-const lib_to_component_mapping *
-lo_get_library_map(void)
+const lib_to_factory_mapping *
+lo_get_factory_map(void)
 {
-    static lib_to_component_mapping map[] = {
-        NON_APP_SPECIFIC_COMPONENT_MAP
+    static lib_to_factory_mapping map[] = {
+        NON_APP_SPECIFIC_FACTORY_MAP
         { "libanimcorelo.a", animcore_component_getFactory },
         { "libavmedialo.a", avmedia_component_getFactory },
         { "libdbalo.a", dba_component_getFactory },
@@ -62,11 +62,11 @@ lo_get_library_map(void)
 
 extern "C"
 __attribute__ ((visibility("default")))
-const lib_to_component_mapping *
-lo_get_implementation_map(void)
+const lib_to_constructor_mapping *
+lo_get_constructor_map(void)
 {
-    static lib_to_component_mapping map[] = {
-        NON_APP_SPECIFIC_DIRECT_COMPONENT_MAP
+    static lib_to_constructor_mapping map[] = {
+        NON_APP_SPECIFIC_CONSTRUCTOR_MAP
         { NULL, NULL }
     };
 
diff --git a/android/experimental/LibreOffice4Android/native-code.cxx b/android/experimental/LibreOffice4Android/native-code.cxx
index 2ec8149..747e816 100644
--- a/android/experimental/LibreOffice4Android/native-code.cxx
+++ b/android/experimental/LibreOffice4Android/native-code.cxx
@@ -11,11 +11,11 @@
 
 extern "C"
 __attribute__ ((visibility("default")))
-const lib_to_component_mapping *
-lo_get_library_map(void)
+const lib_to_factory_mapping *
+lo_get_factory_map(void)
 {
-    static lib_to_component_mapping map[] = {
-        NON_APP_SPECIFIC_COMPONENT_MAP
+    static lib_to_factory_mapping map[] = {
+        NON_APP_SPECIFIC_FACTORY_MAP
         { "libanimcorelo.a", animcore_component_getFactory },
         { "libavmedialo.a", avmedia_component_getFactory },
         { "libbasprov.uno.a", basprov_component_getFactory },
@@ -80,11 +80,11 @@ lo_get_library_map(void)
 
 extern "C"
 __attribute__ ((visibility("default")))
-const lib_to_component_mapping *
-lo_get_implementation_map(void)
+const lib_to_constructor_mapping *
+lo_get_constructor_map(void)
 {
-    static lib_to_component_mapping map[] = {
-        NON_APP_SPECIFIC_DIRECT_COMPONENT_MAP
+    static lib_to_constructor_mapping map[] = {
+        NON_APP_SPECIFIC_CONSTRUCTOR_MAP
         { NULL, NULL }
     };
 
diff --git a/android/experimental/desktop/native-code.cxx b/android/experimental/desktop/native-code.cxx
index b4f15aa..3e44f52 100644
--- a/android/experimental/desktop/native-code.cxx
+++ b/android/experimental/desktop/native-code.cxx
@@ -11,11 +11,11 @@
 
 extern "C"
 __attribute__ ((visibility("default")))
-const lib_to_component_mapping *
-lo_get_library_map(void)
+const lib_to_factory_mapping *
+lo_get_factory_map(void)
 {
-    static lib_to_component_mapping map[] = {
-        NON_APP_SPECIFIC_COMPONENT_MAP
+    static lib_to_factory_mapping map[] = {
+        NON_APP_SPECIFIC_FACTORY_MAP
         { "libanimcorelo.a", animcore_component_getFactory },
         { "libavmedialo.a", avmedia_component_getFactory },
         { "libbasprovlo.a", basprov_component_getFactory },
@@ -92,11 +92,11 @@ lo_get_library_map(void)
 
 extern "C"
 __attribute__ ((visibility("default")))
-const lib_to_component_mapping *
-lo_get_implementation_map(void)
+const lib_to_constructor_mapping *
+lo_get_constructor_map(void)
 {
-    static lib_to_component_mapping map[] = {
-        NON_APP_SPECIFIC_DIRECT_COMPONENT_MAP
+    static lib_to_constructor_mapping map[] = {
+        NON_APP_SPECIFIC_CONSTRUCTOR_MAP
         { NULL, NULL }
     };
 
diff --git a/cppuhelper/source/loadsharedlibcomponentfactory.hxx b/cppuhelper/source/loadsharedlibcomponentfactory.hxx
index 9809c55..9119674 100644
--- a/cppuhelper/source/loadsharedlibcomponentfactory.hxx
+++ b/cppuhelper/source/loadsharedlibcomponentfactory.hxx
@@ -14,18 +14,29 @@
 
 #include <com/sun/star/uno/Reference.hxx>
 
+#include <servicemanager.hxx>
+
 namespace com { namespace sun { namespace star {
     namespace lang { class XMultiServiceFactory; }
-    namespace uno { class XInterface; }
+    namespace uno {
+        class Environment;
+        class XInterface;
+    }
 } } }
 namespace rtl { class OUString; }
 
 namespace cppuhelper { namespace detail {
 
-css::uno::Reference<css::uno::XInterface> loadSharedLibComponentFactory(
+css::uno::Environment getEnvironment(
+    rtl::OUString const & name, rtl::OUString const & implementation);
+
+void loadSharedLibComponentFactory(
     rtl::OUString const & uri, rtl::OUString const & environment,
-    rtl::OUString const & prefix, rtl::OUString const & rImplName,
-    css::uno::Reference<css::lang::XMultiServiceFactory> const & xMgr);
+    rtl::OUString const & prefix, rtl::OUString const & implementation,
+    rtl::OUString const & constructor,
+    css::uno::Reference<css::lang::XMultiServiceFactory> const & serviceManager,
+    ImplementationConstructorFn ** constructorFunction,
+    css::uno::Reference<css::uno::XInterface> * factory);
 
 } }
 
diff --git a/cppuhelper/source/servicemanager.cxx b/cppuhelper/source/servicemanager.cxx
index 3420233..9a271d2 100644
--- a/cppuhelper/source/servicemanager.cxx
+++ b/cppuhelper/source/servicemanager.cxx
@@ -40,6 +40,7 @@
 #include "rtl/ustring.hxx"
 #include "rtl/strbuf.hxx"
 #include "sal/log.hxx"
+#include "uno/environment.hxx"
 
 #include <loadsharedlibcomponentfactory.hxx>
 
@@ -344,18 +345,76 @@ void Parser::handleComponent() {
 }
 
 void Parser::handleImplementation() {
-    OUString name(getNameAttribute());
+    rtl::OUString attrName;
+    rtl::OUString attrConstructor;
+    xmlreader::Span name;
+    int nsId;
+    while (reader_.nextAttribute(&nsId, &name)) {
+        if (nsId == xmlreader::XmlReader::NAMESPACE_NONE
+            && name.equals(RTL_CONSTASCII_STRINGPARAM("name")))
+        {
+            if (!attrName.isEmpty()) {
+                throw css::registry::InvalidRegistryException(
+                    (reader_.getUrl()
+                     + ": <implementation> has multiple \"name\" attributes"),
+                    css::uno::Reference< css::uno::XInterface >());
+            }
+            attrName = reader_.getAttributeValue(false).convertFromUtf8();
+            if (attrName.isEmpty()) {
+                throw css::registry::InvalidRegistryException(
+                    (reader_.getUrl()
+                     + ": <implementation> has empty \"name\" attribute"),
+                    css::uno::Reference< css::uno::XInterface >());
+            }
+        } else if (nsId == xmlreader::XmlReader::NAMESPACE_NONE
+                   && name.equals(RTL_CONSTASCII_STRINGPARAM("constructor")))
+        {
+            if (!attrConstructor.isEmpty()) {
+                throw css::registry::InvalidRegistryException(
+                    (reader_.getUrl()
+                     + (": <implementation> has multiple \"constructor\""
+                        " attributes")),
+                    css::uno::Reference< css::uno::XInterface >());
+            }
+            attrConstructor = reader_.getAttributeValue(false)
+                .convertFromUtf8();
+            if (attrConstructor.isEmpty()) {
+                throw css::registry::InvalidRegistryException(
+                    (reader_.getUrl()
+                     + ": element has empty \"constructor\" attribute"),
+                    css::uno::Reference< css::uno::XInterface >());
+            }
+            if (attrEnvironment_.isEmpty()) {
+                throw css::registry::InvalidRegistryException(
+                    (reader_.getUrl()
+                     + (": <implementation> has \"constructor\" attribute but"
+                        " <component> has no \"environment\" attribute")),
+                    css::uno::Reference< css::uno::XInterface >());
+            }
+        } else {
+            throw css::registry::InvalidRegistryException(
+                (reader_.getUrl() + ": unexpected element attribute \""
+                 + name.convertFromUtf8() + "\" in <implementation>"),
+                css::uno::Reference< css::uno::XInterface >());
+        }
+    }
+    if (attrName.isEmpty()) {
+        throw css::registry::InvalidRegistryException(
+            (reader_.getUrl()
+             + ": <implementation> is missing \"name\" attribute"),
+            css::uno::Reference< css::uno::XInterface >());
+    }
     implementation_.reset(
         new cppuhelper::ServiceManager::Data::Implementation(
-            name, attrLoader_, attrUri_, attrEnvironment_, attrPrefix_,
-            alienContext_, reader_.getUrl()));
+            attrName, attrLoader_, attrUri_, attrEnvironment_, attrConstructor,
+            attrPrefix_, alienContext_, reader_.getUrl()));
     if (!data_->namedImplementations.insert(
             cppuhelper::ServiceManager::Data::NamedImplementations::value_type(
-                name, implementation_)).
+                attrName, implementation_)).
         second)
     {
         throw css::registry::InvalidRegistryException(
-            (reader_.getUrl() + ": duplicate <implementation name=\"" + name
+            (reader_.getUrl() + ": duplicate <implementation name=\"" + attrName
              + "\">"),
             css::uno::Reference< css::uno::XInterface >());
     }
@@ -471,7 +530,7 @@ public:
         boost::shared_ptr<
             cppuhelper::ServiceManager::Data::ImplementationInfo > const &
             info):
-        manager_(manager), info_(info), loaded_(false)
+        manager_(manager), info_(info), loaded_(false), constructor_(0)
     { assert(manager.is() && info.get() != 0); }
 
 private:
@@ -514,6 +573,7 @@ private:
 
     osl::Mutex mutex_;
     bool loaded_;
+    cppuhelper::ImplementationConstructorFn * constructor_;
     css::uno::Reference< css::lang::XSingleComponentFactory > factory1_;
     css::uno::Reference< css::lang::XSingleServiceFactory > factory2_;
 };
@@ -524,7 +584,12 @@ FactoryWrapper::createInstanceWithContext(
     throw (css::uno::Exception, css::uno::RuntimeException)
 {
     loadImplementation(Context);
-    return factory1_.is()
+    return constructor_ != 0
+        ? css::uno::Reference<css::uno::XInterface>(
+            (*constructor_)(
+                Context.get(), css::uno::Sequence<css::uno::Any>().get()),
+            SAL_NO_ACQUIRE)
+        : factory1_.is()
         ? factory1_->createInstanceWithContext(Context)
         : factory2_->createInstance();
 }
@@ -536,7 +601,10 @@ FactoryWrapper::createInstanceWithArgumentsAndContext(
     throw (css::uno::Exception, css::uno::RuntimeException)
 {
     loadImplementation(Context);
-    return factory1_.is()
+    return constructor_ != 0
+        ? css::uno::Reference<css::uno::XInterface>(
+            (*constructor_)(Context.get(), Arguments.get()), SAL_NO_ACQUIRE)
+        : factory1_.is()
         ? factory1_->createInstanceWithArgumentsAndContext(Arguments, Context)
         : factory2_->createInstanceWithArguments(Arguments);
 }
@@ -544,10 +612,7 @@ FactoryWrapper::createInstanceWithArgumentsAndContext(
 css::uno::Reference< css::uno::XInterface > FactoryWrapper::createInstance()
     throw (css::uno::Exception, css::uno::RuntimeException)
 {
-    loadImplementation(manager_->getContext());
-    return factory1_.is()
-        ? factory1_->createInstanceWithContext(manager_->getContext())
-        : factory2_->createInstance();
+    return createInstanceWithContext(manager_->getContext());
 }
 
 css::uno::Reference< css::uno::XInterface >
@@ -555,11 +620,8 @@ FactoryWrapper::createInstanceWithArguments(
     css::uno::Sequence< css::uno::Any > const & Arguments)
     throw (css::uno::Exception, css::uno::RuntimeException)
 {
-    loadImplementation(manager_->getContext());
-    return factory1_.is()
-        ? factory1_->createInstanceWithArgumentsAndContext(
-            Arguments, manager_->getContext())
-        : factory2_->createInstanceWithArguments(Arguments);
+    return createInstanceWithArgumentsAndContext(
+        Arguments, manager_->getContext());
 }
 
 rtl::OUString FactoryWrapper::getImplementationName()
@@ -603,20 +665,23 @@ void FactoryWrapper::loadImplementation(
             return;
         }
     }
+    cppuhelper::ImplementationConstructorFn * ctor = 0;
     css::uno::Reference< css::lang::XSingleComponentFactory > f1;
     css::uno::Reference< css::lang::XSingleServiceFactory > f2;
     //TODO: There is a race here, as the relevant service factory can already
     // have been removed and loading can thus fail, as the entity from which to
     // load can disappear once the service factory is removed:
-    manager_->loadImplementation(context, info_, &f1, &f2);
-    if (!(f1.is() || f2.is())) {
+    manager_->loadImplementation(context, info_, &ctor, &f1, &f2);
+    if (ctor == 0 && !f1.is() && !f2.is()) {
         throw css::uno::DeploymentException(
-            "Implementation " + info_->name + " does not provide a factory",
+            ("Implementation " + info_->name
+             + " does not provide a constructor or factory"),
             static_cast< cppu::OWeakObject * >(this));
     }
     osl::MutexGuard g(mutex_);
     if (!loaded_) {
         loaded_ = true;
+        constructor_ = ctor;
         factory1_ = f1;
         factory2_ = f2;
     }
@@ -647,11 +712,13 @@ void cppuhelper::ServiceManager::addSingletonContextEntries(
 void cppuhelper::ServiceManager::loadImplementation(
         css::uno::Reference< css::uno::XComponentContext > const & context,
         boost::shared_ptr< Data::ImplementationInfo > const & info,
+        ImplementationConstructorFn ** constructor,
         css::uno::Reference< css::lang::XSingleComponentFactory > * factory1,
         css::uno::Reference< css::lang::XSingleServiceFactory > * factory2)
 {
     assert(
-        info.get() != 0 && factory1 != 0 && !factory1->is() && factory2 != 0
+        info.get() != 0 && constructor != 0 && *constructor == 0
+        && factory1 != 0 && !factory1->is() && factory2 != 0
         && !factory2->is());
     rtl::OUString uri;
     try {
@@ -662,13 +729,29 @@ void cppuhelper::ServiceManager::loadImplementation(
             static_cast< cppu::OWeakObject * >(this));
     }
     css::uno::Reference< css::uno::XInterface > f0;
-    // Shortcut loading via SharedLibrary loader, to pass in environment and
-    // prefix arguments:
+    // Special handling of SharedLibrary loader, with support for environment,
+    // constructor, and prefix arguments:
     if (!info->alienContext.is()
         && info->loader == "com.sun.star.loader.SharedLibrary")
     {
-        f0 = cppuhelper::detail::loadSharedLibComponentFactory(
-            uri, info->environment, info->prefix, info->name, this);
+        cppuhelper::detail::loadSharedLibComponentFactory(
+            uri, info->environment, info->prefix, info->name, info->constructor,
+            this, constructor, &f0);
+        if (constructor != 0 && *constructor != 0) {
+            assert(!info->environment.isEmpty());
+            css::uno::Environment curEnv(css::uno::Environment::getCurrent());
+            css::uno::Environment env(
+                cppuhelper::detail::getEnvironment(
+                    info->environment, info->name));
+            if (!(curEnv.is() && env.is())) {
+                throw css::uno::DeploymentException(
+                    "cannot get environments",
+                    css::uno::Reference<css::uno::XInterface>());
+            }
+            if (curEnv.get() != env.get()) {
+                std::abort();//TODO
+            }
+        }
     } else {
         SAL_WARN_IF(
             !info->environment.isEmpty(), "cppuhelper",
@@ -676,6 +759,10 @@ void cppuhelper::ServiceManager::loadImplementation(
                 << info->environment);
         SAL_WARN_IF(
             !info->prefix.isEmpty(), "cppuhelper",
+            "Loader " << info->loader << " and non-empty constructor "
+                << info->constructor);
+        SAL_WARN_IF(
+            !info->prefix.isEmpty(), "cppuhelper",
             "Loader " << info->loader << " and non-empty prefix "
                 << info->prefix);
         css::uno::Reference< css::uno::XComponentContext > ctxt;
@@ -810,7 +897,12 @@ cppuhelper::ServiceManager::createInstanceWithContext(
     if (impl.get() == 0) {
         return css::uno::Reference< css::uno::XInterface >();
     }
-    if (impl->factory1.is()) {
+    if (impl->constructor != 0) {
+        return css::uno::Reference<css::uno::XInterface>(
+            (*impl->constructor)(
+                Context.get(), css::uno::Sequence<css::uno::Any>().get()),
+            SAL_NO_ACQUIRE);
+    } else if (impl->factory1.is()) {
         return impl->factory1->createInstanceWithContext(Context);
     }
     if (impl->factory2.is()) {
@@ -833,7 +925,11 @@ cppuhelper::ServiceManager::createInstanceWithArgumentsAndContext(
     if (impl.get() == 0) {
         return css::uno::Reference< css::uno::XInterface >();
     }
-    if (impl->factory1.is()) {
+    if (impl->constructor != 0) {
+        return css::uno::Reference<css::uno::XInterface>(
+            (*impl->constructor)(Context.get(), Arguments.get()),
+            SAL_NO_ACQUIRE);
+    } else if (impl->factory1.is()) {
         return impl->factory1->createInstanceWithArgumentsAndContext(
             Arguments, Context);
     }
@@ -1309,7 +1405,7 @@ bool cppuhelper::ServiceManager::readLegacyRdbFile(rtl::OUString const & uri) {
         boost::shared_ptr< Data::Implementation > impl(
             new Data::Implementation(
                 name, readLegacyRdbString(uri, implKey, "UNO/ACTIVATOR"),
-                readLegacyRdbString(uri, implKey, "UNO/LOCATION"), "", "",
+                readLegacyRdbString(uri, implKey, "UNO/LOCATION"), "", "", "",
                 css::uno::Reference< css::uno::XComponentContext >(), uri));
         if (!data_.namedImplementations.insert(
                 Data::NamedImplementations::value_type(name, impl)).
@@ -1679,12 +1775,14 @@ cppuhelper::ServiceManager::findServiceImplementation(
     // while the mutex is unlocked and loading can thus fail, as the entity from
     // which to load can disappear once the service factory is removed.
     if (!loaded) {
+        cppuhelper::ImplementationConstructorFn * ctor = 0;
         css::uno::Reference< css::lang::XSingleComponentFactory > f1;
         css::uno::Reference< css::lang::XSingleServiceFactory > f2;
-        loadImplementation(context, impl->info, &f1, &f2);
+        loadImplementation(context, impl->info, &ctor, &f1, &f2);
         osl::MutexGuard g(rBHelper.rMutex);
         if (!(isDisposed() || impl->loaded)) {
             impl->loaded = true;
+            impl->constructor = ctor;
             impl->factory1 = f1;
             impl->factory2 = f2;
         }
diff --git a/cppuhelper/source/servicemanager.hxx b/cppuhelper/source/servicemanager.hxx
index b68cd4b..d76b93f 100644
--- a/cppuhelper/source/servicemanager.hxx
+++ b/cppuhelper/source/servicemanager.hxx
@@ -34,10 +34,20 @@
 #include "registry/registry.hxx"
 #include "rtl/ustring.hxx"
 
+namespace com { namespace sun { namespace star { namespace lang {
+    class XSingleComponentFactory;
+} } } }
 namespace cppu { struct ContextEntry_Init; }
 
 namespace cppuhelper {
 
+extern "C" {
+
+typedef css::uno::XInterface * SAL_CALL ImplementationConstructorFn(
+    css::uno::XComponentContext *, uno_Sequence *);
+
+}
+
 typedef cppu::WeakComponentImplHelper8<
     css::lang::XServiceInfo, css::lang::XMultiServiceFactory,
     css::lang::XMultiComponentFactory, css::container::XSet,
@@ -55,13 +65,15 @@ public:
                 rtl::OUString const & theName, rtl::OUString const & theLoader,
                 rtl::OUString const & theUri,
                 rtl::OUString const & theEnvironment,
+                rtl::OUString const & theConstructor,
                 rtl::OUString const & thePrefix,
                 css::uno::Reference< css::uno::XComponentContext > const &
                     theAlienContext,
                 rtl::OUString const & theRdbFile):
                 name(theName), loader(theLoader), uri(theUri),
-                environment(theEnvironment), prefix(thePrefix),
-                alienContext(theAlienContext), rdbFile(theRdbFile)
+                environment(theEnvironment), constructor(theConstructor),
+                prefix(thePrefix), alienContext(theAlienContext),
+                rdbFile(theRdbFile)
             {}
 
             explicit ImplementationInfo(rtl::OUString const & theName):
@@ -71,6 +83,7 @@ public:
             rtl::OUString const loader;
             rtl::OUString const uri;
             rtl::OUString const environment;
+            rtl::OUString const constructor;
             rtl::OUString const prefix;
             css::uno::Reference< css::uno::XComponentContext > const
                 alienContext;
@@ -83,15 +96,16 @@ public:
             Implementation(
                 rtl::OUString const & name, rtl::OUString const & loader,
                 rtl::OUString const & uri, rtl::OUString const & environment,
+                rtl::OUString const & constructorName,
                 rtl::OUString const & prefix,
                 css::uno::Reference< css::uno::XComponentContext > const &
                     alienContext,
                 rtl::OUString const & rdbFile):
                 info(
                     new ImplementationInfo(
-                        name, loader, uri, environment, prefix, alienContext,
-                        rdbFile)),
-                loaded(false)
+                        name, loader, uri, environment, constructorName, prefix,
+                        alienContext, rdbFile)),
+                constructor(0), loaded(false)
             {}
 
             Implementation(
@@ -102,11 +116,13 @@ public:
                     theFactory2,
                 css::uno::Reference< css::lang::XComponent > const &
                     theComponent):
-                info(new ImplementationInfo(name)), factory1(theFactory1),
-                factory2(theFactory2), component(theComponent), loaded(true)
+                info(new ImplementationInfo(name)), constructor(0),
+                factory1(theFactory1), factory2(theFactory2),
+                component(theComponent), loaded(true)
             {}
 
             boost::shared_ptr< ImplementationInfo > info;
+            ImplementationConstructorFn * constructor;
             css::uno::Reference< css::lang::XSingleComponentFactory > factory1;
             css::uno::Reference< css::lang::XSingleServiceFactory > factory2;
             css::uno::Reference< css::lang::XComponent > component;
@@ -160,6 +176,7 @@ public:
     void loadImplementation(
         css::uno::Reference< css::uno::XComponentContext > const & context,
         boost::shared_ptr< Data::ImplementationInfo > const & info,
+        ImplementationConstructorFn ** constructor,
         css::uno::Reference< css::lang::XSingleComponentFactory > * factory1,
         css::uno::Reference< css::lang::XSingleServiceFactory > * factory2);
 
diff --git a/cppuhelper/source/shlib.cxx b/cppuhelper/source/shlib.cxx
index 81e02d3..972357b 100644
--- a/cppuhelper/source/shlib.cxx
+++ b/cppuhelper/source/shlib.cxx
@@ -17,456 +17,333 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#include "sal/config.h"
+#include <sal/config.h>
 
 #include <cassert>
+#include <cstdlib>
 
-#include "osl/module.hxx"
-#include "uno/environment.h"
-#include <uno/lbnames.h>
-#include "uno/mapping.hxx"
-#include "cppuhelper/factory.hxx"
-#include "cppuhelper/shlib.hxx"
-
-#include "com/sun/star/beans/XPropertySet.hpp"
+#include <com/sun/star/loader/CannotActivateFactoryException.hpp>
+#include <cppuhelper/factory.hxx>
+#include <cppuhelper/shlib.hxx>
+#include <osl/module.hxx>
+#include <uno/environment.hxx>
+#include <uno/mapping.hxx>
 
 #include <loadsharedlibcomponentfactory.hxx>
 
-#include <stdio.h>
-
-#ifdef ANDROID
+#if defined ANDROID
 #include <osl/detail/android-bootstrap.h>
-#endif
-
-#ifdef IOS
+#elif defined IOS
 #include <osl/detail/component-mapping.h>
 #endif
 
-using namespace ::osl;
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::uno;
-
-using rtl::OString;
-using rtl::OUString;
-
-namespace {
-
-uno::Environment getEnvironment(
-    OUString const & name, OUString const & cImplName)
+css::uno::Environment cppuhelper::detail::getEnvironment(
+    rtl::OUString const & name, rtl::OUString const & implementation)
 {
-    OUString n(name);
-    static const char * pUNO_ENV_LOG = ::getenv( "UNO_ENV_LOG" );
-    if (pUNO_ENV_LOG && rtl_str_getLength(pUNO_ENV_LOG) )
-    {
-        OString implName(OUStringToOString(cImplName, RTL_TEXTENCODING_ASCII_US));
-        OString aEnv( pUNO_ENV_LOG );
-        sal_Int32 nIndex = 0;
-        do
-        {
-            const OString aStr( aEnv.getToken( 0, ';', nIndex ) );
-            if ( aStr.equals(implName) )
-            {
-                n += ::rtl::OUString(":log");
+    assert(!implementation.isEmpty());
+    rtl::OUString n(name);
+    static char const * log = std::getenv("UNO_ENV_LOG");
+    if (log != 0 && *log != 0) {
+        rtl::OString imps(log);
+        for (sal_Int32 i = 0; i != -1;) {
+            rtl::OString imp(imps.getToken(0, ';', i));
+            //TODO: this assumes UNO_ENV_LOG only contains ASCII characters:
+            if (implementation.equalsAsciiL(imp.getStr(), imp.getLength())) {
+                n += ":log";
                 break;
             }
-        } while( nIndex != -1 );
+        }
     }
-    return uno::Environment(n);
+    return css::uno::Environment(n);
 }
 
-#ifndef DISABLE_DYNLOADING
-
-void getLibEnv(oslModule                lib,
-                      uno::Environment       * pEnv,
-                      uno::Environment const & cTargetEnv,
-                      OUString         const & cImplName = OUString(),
-                      OUString         const & rPrefix = OUString())
-{
-    sal_Char const * pEnvTypeName = NULL;
+namespace {
 
-    OUString aGetEnvNameExt = rPrefix + COMPONENT_GETENVEXT;
-    component_getImplementationEnvironmentExtFunc pGetImplEnvExt =
-        (component_getImplementationEnvironmentExtFunc)osl_getFunctionSymbol(lib, aGetEnvNameExt.pData);
+#if !defined DISABLE_DYNLOADING
 
-    if (pGetImplEnvExt)
-    {
-        OString implName(OUStringToOString(cImplName, RTL_TEXTENCODING_ASCII_US));
-        pGetImplEnvExt(&pEnvTypeName, (uno_Environment **)pEnv, implName.getStr(), cTargetEnv.get());
+css::uno::Environment getEnvironmentFromModule(
+    osl::Module const & module, css::uno::Environment const & target,
+    rtl::OUString const & implementation, rtl::OUString const & prefix)
+{
+    char const * name = 0;
+    css::uno::Environment env;
+    rtl::OUString fullPrefix(prefix);
+    if (!fullPrefix.isEmpty()) {
+        fullPrefix += "_";
     }
-    else
-    {
-        OUString aGetEnvName = rPrefix + COMPONENT_GETENV;
-        component_getImplementationEnvironmentFunc pGetImplEnv =
-            (component_getImplementationEnvironmentFunc)osl_getFunctionSymbol(
-                lib, aGetEnvName.pData );
-        if (pGetImplEnv)
-            pGetImplEnv(&pEnvTypeName, (uno_Environment **)pEnv);
-
-        else // this symbol used to be mandatory, but is no longer
-            pEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
+    component_getImplementationEnvironmentExtFunc fp1
+        = reinterpret_cast<component_getImplementationEnvironmentExtFunc>(
+            module.getFunctionSymbol(fullPrefix + COMPONENT_GETENVEXT));
+    if (fp1 != 0) {
+        (*fp1)(
+            &name, reinterpret_cast<uno_Environment **>(&env),
+            (rtl::OUStringToOString(implementation, RTL_TEXTENCODING_ASCII_US)
+             .getStr()),
+            target.get());
+    } else {
+        component_getImplementationEnvironmentFunc fp2
+            = reinterpret_cast<component_getImplementationEnvironmentFunc>(
+                module.getFunctionSymbol(fullPrefix + COMPONENT_GETENV));
+        if (fp2 != 0) {
+            (*fp2)(&name, reinterpret_cast<uno_Environment **>(&env));
+        } else {
+            name = CPPU_CURRENT_LANGUAGE_BINDING_NAME; //TODO: fail
+        }
     }
-
-    if (!pEnv->is() && pEnvTypeName)
-    {
-        *pEnv = getEnvironment(
-            OUString::createFromAscii(pEnvTypeName), cImplName);
+    if (!env.is() && name != 0) {
+        env = cppuhelper::detail::getEnvironment(
+            rtl::OUString::createFromAscii(name), implementation);
     }
+    return env;
 }
 
 #endif
 
-extern "C" void s_getFactory(va_list * pParam)
-{
-    component_getFactoryFunc         pSym      = va_arg(*pParam, component_getFactoryFunc);
-    OString                  const * pImplName = va_arg(*pParam, OString const *);
-    void                           * pSMgr     = va_arg(*pParam, void *);
-    void                           * pKey      = va_arg(*pParam, void *);
-    void                          ** ppSSF     = va_arg(*pParam, void **);
-
-    *ppSSF = pSym(pImplName->getStr(), pSMgr, pKey);
+extern "C" void getFactory(va_list * args) {
+    component_getFactoryFunc fn = va_arg(*args, component_getFactoryFunc);
+    rtl::OString const * implementation = va_arg(*args, rtl::OString const *);
+    void * smgr = va_arg(*args, void *);
+    void * key = va_arg(*args, void *);
+    void ** factory = va_arg(*args, void **);
+    *factory = (*fn)(implementation->getStr(), smgr, key);
 }
 
-}
-
-namespace cppu
-{
-
-/* For backwards compatibility */
-Reference< XInterface > SAL_CALL loadSharedLibComponentFactory(
-    OUString const & uri, OUString const & rPath, OUString const & rImplName,
-    Reference< lang::XMultiServiceFactory > const & xMgr,
-    Reference< registry::XRegistryKey > const & xKey )
-    SAL_THROW( (loader::CannotActivateFactoryException) )
+css::uno::Reference<css::uno::XInterface> invokeComponentFactory(
+    css::uno::Environment const & source, css::uno::Environment const & target,
+    component_getFactoryFunc function, rtl::OUString const & uri,
+    rtl::OUString const & implementation,
+    css::uno::Reference<css::lang::XMultiServiceFactory> const & serviceManager)
 {
-    assert(rPath.isEmpty());
-    assert(!xKey.is());
-    (void) rPath;
-    (void) xKey;
-    return cppuhelper::detail::loadSharedLibComponentFactory(
-        uri, "", "", rImplName, xMgr);
+    if (!(source.is() && target.is())) {
+        throw css::loader::CannotActivateFactoryException(
+            "cannot get environments",
+            css::uno::Reference<css::uno::XInterface>());
+    }
+    rtl::OString impl(
+        rtl::OUStringToOString(implementation, RTL_TEXTENCODING_ASCII_US));
+    if (source.get() == target.get()) {
+        return css::uno::Reference<css::uno::XInterface>(
+            static_cast<css::uno::XInterface *>(
+                (*function)(impl.getStr(), serviceManager.get(), 0)),
+            SAL_NO_ACQUIRE);
+    } else {
+        css::uno::Mapping mapTo(source, target);
+        css::uno::Mapping mapFrom(target, source);
+        if (!(mapTo.is() && mapFrom.is())) {
+            throw css::loader::CannotActivateFactoryException(
+                "cannot get mappings",
+                css::uno::Reference<css::uno::XInterface>());
+        }
+        void * smgr = mapTo.mapInterface(
+            serviceManager.get(),
+            cppu::UnoType<css::lang::XMultiServiceFactory>::get());
+        void * factory = 0;
+        target.invoke(getFactory, function, &impl, smgr, 0, &factory);
+        if (smgr != 0) {
+            (*target.get()->pExtEnv->releaseInterface)(
+                target.get()->pExtEnv, smgr);
+        }
+        if (factory == 0) {
+            throw css::loader::CannotActivateFactoryException(
+                ("calling factory function for \"" + implementation + "\" in <"
+                 + uri + "> returned null"),
+                css::uno::Reference<css::uno::XInterface>());
+        }
+        css::uno::Reference<css::uno::XInterface> res;
+        mapFrom.mapInterface(
+            reinterpret_cast<void **>(&res), factory,
+            cppu::UnoType<css::uno::XInterface>::get());
+        (*target.get()->pExtEnv->releaseInterface)(
+            target.get()->pExtEnv, factory);
+        return res;
+    }
 }
 
 }
 
-namespace
+void cppuhelper::detail::loadSharedLibComponentFactory(
+    rtl::OUString const & uri, rtl::OUString const & environment,
+    rtl::OUString const & prefix, rtl::OUString const & implementation,
+    rtl::OUString const & constructor,
+    css::uno::Reference<css::lang::XMultiServiceFactory> const & serviceManager,
+    ImplementationConstructorFn ** constructorFunction,
+    css::uno::Reference<css::uno::XInterface> * factory)
 {
-
-Reference< XInterface > invokeComponentFactory(
-    uno::Environment const & env,
-    oslGenericFunction pGetter,
-    OUString const & rModulePath,
-    OUString const & rImplName,
-    Reference< ::com::sun::star::lang::XMultiServiceFactory > const & xMgr,
-    OUString &rExcMsg )
-{
-    Reference< XInterface > xRet;
-    uno::Environment currentEnv(Environment::getCurrent());
-
-    OString aImplName(
-        OUStringToOString( rImplName, RTL_TEXTENCODING_ASCII_US ) );
-
-    if (env.is() && currentEnv.is())
-    {
-#if OSL_DEBUG_LEVEL > 1
-        {
-            rtl::OString modPath(rtl::OUStringToOString(rModulePath, RTL_TEXTENCODING_ASCII_US));
-            rtl::OString implName(rtl::OUStringToOString(rImplName, RTL_TEXTENCODING_ASCII_US));
-            rtl::OString envDcp(rtl::OUStringToOString(env.getTypeName(), RTL_TEXTENCODING_ASCII_US));
-
-            fprintf(stderr, "invokeComponentFactory envDcp:%s implName:%s modPath:%s\n", envDcp.getStr(), implName.getStr(), modPath.getStr());
+    assert(constructor.isEmpty() || !environment.isEmpty());
+    assert(
+        (constructorFunction == 0 && constructor.isEmpty())
+        || *constructorFunction == 0);
+    assert(factory != 0 && !factory->is());
+#if defined DISABLE_DYNLOADING
+    assert(!environment.isEmpty());
+    if (constructor.isEmpty()) {
+        css::uno::Environment curEnv(css::uno::Environment::getCurrent());
+        css::uno::Environment env(getEnvironment(environment, implementation));
+        if (!(curEnv.is() && env.is())) {
+            throw css::loader::CannotActivateFactoryException(
+                "cannot get environments",
+                css::uno::Reference<css::uno::XInterface>());
         }
-#endif
-        if (env.get() == currentEnv.get())
-        {
-            xRet.set(
-                static_cast<css::uno::XInterface *>(
-                    (*reinterpret_cast<component_getFactoryFunc>(pGetter))(
-                        aImplName.getStr(), xMgr.get(), 0)),
-                SAL_NO_ACQUIRE);
+        if (curEnv.get() != env.get()) {
+            std::abort();//TODO
         }
-        else
-        {
-            Mapping aCurrent2Env( currentEnv, env );
-            Mapping aEnv2Current( env, currentEnv );
-
-            if (aCurrent2Env.is() && aEnv2Current.is())
-            {
-                void * pSMgr = aCurrent2Env.mapInterface(
-                    xMgr.get(), ::getCppuType( &xMgr ) );
-
-                void * pSSF = NULL;
-
-                env.invoke(s_getFactory, pGetter, &aImplName, pSMgr, 0, &pSSF);
-
-                if (pSMgr)
-                {
-                    (*env.get()->pExtEnv->releaseInterface)(
-                        env.get()->pExtEnv, pSMgr );
-                }
-
-                if (pSSF)
-                {
-                    aEnv2Current.mapInterface(
-                        reinterpret_cast< void ** >( &xRet ),
-                        pSSF, ::getCppuType( &xRet ) );
-                    (env.get()->pExtEnv->releaseInterface)(
-                        env.get()->pExtEnv, pSSF );
-                }
-                else
-                {
-                    rExcMsg = rModulePath +
-                        ": cannot get factory of " +
-                        "demanded implementation: " +
-                        OStringToOUString(
-                            aImplName, RTL_TEXTENCODING_ASCII_US );
-                }
+        rtl::OUString name(prefix == "direct" ? implementation : uri);
+        lib_to_factory_mapping const * map = lo_get_factory_map();
+        component_getFactoryFunc fp;
+        for (int i = 0; map[i].name != 0; ++i) {
+            if (name.equalsAscii(map[i].name)) {
+                fp = map[i].component_getFactory_function;
+                break;
             }
-            else
-            {
-                rExcMsg =
-                    "cannot get uno mappings: C++ <=> UNO!";
+        }
+        if (fp == 0) {
+            throw css::loader::CannotActivateFactoryException(
+                "unknown factory name \"" + name + "\"",
+                css::uno::Reference<css::uno::XInterface>());
+        }
+        *factory = invokeComponentFactory(
+            css::uno::Environment::getCurrent(),
+            getEnvironment(environment, implementation), fp, uri,
+            implementation, serviceManager);
+    } else {
+        lib_to_constructor_mapping const * map = lo_get_constructor_map();
+        for (int i = 0; map[i].name != 0; ++i) {
+            if (constructor.equalsAscii(map[i].name)) {
+                *constructorFunction
+                    = reinterpret_cast<ImplementationConstructorFn *>(
+                        map[i].constructor_function);
+                return;
             }
         }
-    }
-    else
-    {
-        rExcMsg = "cannot get uno environments!";
-    }
-
-    return xRet;
-}
-
-} // namespace
-
-namespace cppuhelper { namespace detail {
-
-css::uno::Reference<css::uno::XInterface> loadSharedLibComponentFactory(
-    OUString const & uri, OUString const & rEnvironment,
-    OUString const & rPrefix, OUString const & rImplName,
-    css::uno::Reference<css::lang::XMultiServiceFactory> const & xMgr)
-{
-#ifndef DISABLE_DYNLOADING
-    OUString moduleUri(uri);
-    oslModule lib = osl_loadModule(
-        moduleUri.pData, SAL_LOADMODULE_LAZY | SAL_LOADMODULE_GLOBAL );
-    if (! lib)
-    {
-        OUString const msg("loading component library failed: " + moduleUri);
-        SAL_WARN("cppuhelper", msg);
-        throw loader::CannotActivateFactoryException(msg,
-            Reference< XInterface >() );
+        throw css::loader::CannotActivateFactoryException(
+            "unknown constructor name \"" + constructor + "\"",
+            css::uno::Reference<css::uno::XInterface>());
     }
 #else
-    oslModule lib;
-    OUString moduleUri("MAIN");
-    if (! osl_getModuleHandle( NULL, &lib))
-    {
-        throw loader::CannotActivateFactoryException(
-            "osl_getModuleHandle of the executable: ",
-            Reference< XInterface >() );
-    }
-#endif
-
-    Reference< XInterface > xRet;
-
-    OUString aExcMsg;
-
-    OUString aFullPrefix(rPrefix);
-    if (!aFullPrefix.isEmpty()) {
-        aFullPrefix += "_";
-    }
-    OUString aGetFactoryName = aFullPrefix + COMPONENT_GETFACTORY;
-    if (rPrefix == "direct")
-        aGetFactoryName = rImplName.replace('.', '_') + "_" + COMPONENT_GETFACTORY;
-
-    oslGenericFunction pSym = NULL;
-
-#ifdef DISABLE_DYNLOADING
-
-    OString sName;
-    const lib_to_component_mapping *map = NULL;
-    if (rPrefix == "direct")
-    {
-        sName = OUStringToOString(rImplName, RTL_TEXTENCODING_ASCII_US);
-        map = lo_get_implementation_map();
-    }
-    else
-    {
-        sName = OUStringToOString(uri, RTL_TEXTENCODING_ASCII_US);
-        map = lo_get_library_map();
-    }
-    for (int i = 0; pSym == NULL && map[i].name != NULL; ++i)
-    {
-        if ( sName == map[i].name )
-            pSym = (oslGenericFunction) map[i].component_getFactory_function;
-    }
-    if ( pSym == NULL )
-    {
-        fprintf( stderr, "attempting to load unknown library %s\n", OUStringToOString( uri, RTL_TEXTENCODING_ASCII_US ).getStr() );
-        assert( !"Attempt to load unknown library" );
+    osl::Module mod(uri, SAL_LOADMODULE_LAZY | SAL_LOADMODULE_GLOBAL);
+    if (!mod.is()) {
+        throw css::loader::CannotActivateFactoryException(
+            "loading component library <" + uri + "> failed",
+            css::uno::Reference<css::uno::XInterface>());
     }
-#else
-
-    if ( pSym == NULL )
-        pSym = osl_getFunctionSymbol( lib, aGetFactoryName.pData );
-#endif
-
-    if (pSym != 0)
-    {
-        uno::Environment env;
-        if (rEnvironment.isEmpty()) {
-#if defined DISABLE_DYNLOADING
-            //TODO: assert(false); // this cannot happen
-            env = getEnvironment(CPPU_CURRENT_LANGUAGE_BINDING_NAME, rImplName);
-
-#else
-            getLibEnv(
-                lib, &env, Environment::getCurrent(), rImplName, aFullPrefix);
-#endif
+    if (constructor.isEmpty()) {
+        rtl::OUString sym;
+        if (prefix == "direct") {
+            sym = implementation.replace('.', '_') + "_" + COMPONENT_GETFACTORY;
+        } else if (!prefix.isEmpty()) {
+            sym = prefix + "_" + COMPONENT_GETFACTORY;
         } else {
-            env = getEnvironment(rEnvironment, rImplName);
+            sym = COMPONENT_GETFACTORY;
         }
-
-        xRet = invokeComponentFactory(
-            env, pSym, moduleUri, rImplName, xMgr, aExcMsg );
-    }
-    else
-    {
-        aExcMsg = moduleUri;
-        aExcMsg += ": cannot get symbol: ";
-        aExcMsg += aGetFactoryName;
+        oslGenericFunction fp = mod.getFunctionSymbol(sym);
+        if (fp == 0) {
+            throw css::loader::CannotActivateFactoryException(
+                ("no factory symbol \"" + sym + "\" in component library <"
+                 + uri + ">"),
+                css::uno::Reference<css::uno::XInterface>());
+        }
+        css::uno::Environment curEnv(css::uno::Environment::getCurrent());
+        *factory = invokeComponentFactory(
+            curEnv,
+            (environment.isEmpty()
+             ? getEnvironmentFromModule(mod, curEnv, implementation, prefix)
+             : getEnvironment(environment, implementation)),
+            reinterpret_cast<component_getFactoryFunc>(fp), uri, implementation,
+            serviceManager);
+    } else {
+        oslGenericFunction fp = mod.getFunctionSymbol(constructor);
+        if (fp == 0) {
+            throw css::loader::CannotActivateFactoryException(
+                ("no constructor symbol \"" + constructor
+                 + "\" in component library <" + uri + ">"),
+                css::uno::Reference<css::uno::XInterface>());
+        }
+        *constructorFunction = reinterpret_cast<ImplementationConstructorFn *>(
+            fp);
     }
-
-    if (! xRet.is())
-    {
-#ifndef DISABLE_DYNLOADING
-        osl_unloadModule( lib );
+    mod.release();
 #endif
-        SAL_WARN("cppuhelper", "### cannot activate factory: " << aExcMsg);
-        throw loader::CannotActivateFactoryException(
-            aExcMsg,
-            Reference< XInterface >() );
-    }
-    return xRet;
 }
 
-} }
+#if !defined DISABLE_DYNLOADING
 
-#ifndef DISABLE_DYNLOADING
-
-//==============================================================================
-extern "C" { static void s_writeInfo(va_list * pParam)
+css::uno::Reference<css::uno::XInterface> cppu::loadSharedLibComponentFactory(
+    rtl::OUString const & uri, rtl::OUString const & rPath,
+    rtl::OUString const & rImplName,
+    css::uno::Reference<css::lang::XMultiServiceFactory> const & xMgr,
+    css::uno::Reference<css::registry::XRegistryKey> const & xKey)
+    SAL_THROW((css::loader::CannotActivateFactoryException))
 {
-    component_writeInfoFunc         pSym      = va_arg(*pParam, component_writeInfoFunc);
-    void                          * pSMgr     = va_arg(*pParam, void *);
-    void                          * pKey      = va_arg(*pParam, void *);
-    sal_Bool                      * pbRet     = va_arg(*pParam, sal_Bool *);
+    assert(rPath.isEmpty()); (void) rPath;
+    assert(!xKey.is()); (void) xKey;
+    css::uno::Reference<css::uno::XInterface> fac;
+    cppuhelper::detail::loadSharedLibComponentFactory(
+        uri, "", "", rImplName, "", xMgr, 0, &fac);
+    return fac;
+}
 
-    *pbRet = pSym(pSMgr, pKey);
+namespace {
 
-}}
+extern "C" void writeInfo(va_list * args) {
+    component_writeInfoFunc fn = va_arg(*args, component_writeInfoFunc);
+    void * smgr = va_arg(*args, void *);
+    void * key = va_arg(*args, void *);
+    sal_Bool * ok = va_arg(*args, sal_Bool *);
+    *ok = (*fn)(smgr, key);
+}
 
-namespace cppu {
+}
 
-void SAL_CALL writeSharedLibComponentInfo(
-    OUString const & uri, OUString const & rPath,
-    Reference< lang::XMultiServiceFactory > const & xMgr,
-    Reference< registry::XRegistryKey > const & xKey )
-    SAL_THROW( (registry::CannotRegisterImplementationException) )
+void cppu::writeSharedLibComponentInfo(
+    rtl::OUString const & uri, rtl::OUString const & rPath,
+    css::uno::Reference<css::lang::XMultiServiceFactory> const & xMgr,
+    css::uno::Reference<css::registry::XRegistryKey> const & xKey)
+    SAL_THROW((css::registry::CannotRegisterImplementationException))
 {
-    (void) rPath;
-    assert(rPath.isEmpty());
-    oslModule lib = osl_loadModule(
-        uri.pData, SAL_LOADMODULE_LAZY | SAL_LOADMODULE_GLOBAL );
-    if (! lib)
-    {
-        OUString const msg("loading component library failed: " + uri);
-        SAL_WARN("cppuhelper", msg);
-        throw registry::CannotRegisterImplementationException(msg,
-            Reference< XInterface >() );
+    assert(rPath.isEmpty()); (void) rPath;
+    osl::Module mod(uri, SAL_LOADMODULE_LAZY | SAL_LOADMODULE_GLOBAL);
+    if (!mod.is()) {
+        throw css::registry::CannotRegisterImplementationException(
+            "loading component library <" + uri + "> failed",
+            css::uno::Reference<css::uno::XInterface>());
     }
-
-    sal_Bool bRet = sal_False;
-
-    uno::Environment currentEnv(Environment::getCurrent());
-    uno::Environment env;
-
-    OUString aExcMsg;
-
-    getLibEnv(lib, &env, currentEnv);
-
-    OUString aWriteInfoName = COMPONENT_WRITEINFO;
-    oslGenericFunction pSym = osl_getFunctionSymbol( lib, aWriteInfoName.pData );
-    if (pSym != 0)
-    {
-        if (env.is() && currentEnv.is())
-        {
-            Mapping aCurrent2Env( currentEnv, env );
-            if (aCurrent2Env.is())
-            {
-                void * pSMgr = aCurrent2Env.mapInterface(
-                    xMgr.get(), ::getCppuType( &xMgr ) );
-                void * pKey = aCurrent2Env.mapInterface(
-                    xKey.get(), ::getCppuType( &xKey ) );
-                if (pKey)
-                {
-                    env.invoke(s_writeInfo, pSym, pSMgr, pKey, &bRet);
-
-
-                    (*env.get()->pExtEnv->releaseInterface)(
-                        env.get()->pExtEnv, pKey );
-                    if (! bRet)
-                    {
-                        aExcMsg = uri;
-                        aExcMsg += ": component_writeInfo() "
-                                   "returned false!";
-                    }
-                }
-                else
-                {
-                    // key is mandatory
-                    aExcMsg = uri;
-                    aExcMsg += ": registry is mandatory to invoke"
-                               " component_writeInfo()!";
-                }
-
-                if (pSMgr)
-                {
-                    (*env.get()->pExtEnv->releaseInterface)(
-                        env.get()->pExtEnv, pSMgr );
-                }
-            }
-            else
-            {
-                aExcMsg = "cannot get uno mapping: C++ <=> UNO!";
-            }
-        }
-        else
-        {
-            aExcMsg = "cannot get uno environments!";
-        }
+    oslGenericFunction fp = mod.getFunctionSymbol(COMPONENT_WRITEINFO);
+    if (fp == 0) {
+        throw css::registry::CannotRegisterImplementationException(
+            ("no symbol \"" COMPONENT_WRITEINFO "\" in component library <"
+             + uri + ">"),
+            css::uno::Reference<css::uno::XInterface>());
     }
-    else
-    {
-        aExcMsg = uri;
-        aExcMsg += ": cannot get symbol: ";
-        aExcMsg += aWriteInfoName;
+    css::uno::Environment curEnv(css::uno::Environment::getCurrent());
+    css::uno::Environment env(getEnvironmentFromModule(mod, curEnv, "", ""));
+    if (!(curEnv.is() && env.is())) {
+        throw css::registry::CannotRegisterImplementationException(
+            "cannot get environments",
+            css::uno::Reference<css::uno::XInterface>());
     }
-
-//!
-//! OK: please look at #88219#
-//!
-//! ::osl_unloadModule( lib);
-    if (! bRet)
-    {
-        SAL_WARN("cppuhelper", "### cannot write component info: " << aExcMsg);
-        throw registry::CannotRegisterImplementationException(
-            aExcMsg, Reference< XInterface >() );
+    css::uno::Mapping map(curEnv, env);
+    if (!map.is()) {
+        throw css::registry::CannotRegisterImplementationException(
+            "cannot get mapping", css::uno::Reference<css::uno::XInterface>());
+    }
+    void * smgr = map.mapInterface(
+        xMgr.get(), cppu::UnoType<css::lang::XMultiServiceFactory>::get());
+    void * key = map.mapInterface(
+        xKey.get(), cppu::UnoType<css::registry::XRegistryKey>::get());
+    sal_Bool ok;
+    env.invoke(writeInfo, fp, smgr, key, &ok);
+    (*env.get()->pExtEnv->releaseInterface)(env.get()->pExtEnv, key);
+    if (smgr != 0) {
+        (*env.get()->pExtEnv->releaseInterface)(env.get()->pExtEnv, smgr);
+    }
+    if (!ok) {
+        throw css::registry::CannotRegisterImplementationException(
+            ("calling \"" COMPONENT_WRITEINFO "\" in component library <" + uri
+             + "> returned false"),
+            css::uno::Reference<css::uno::XInterface>());
     }
 }
 
-}
-
-#endif // DISABLE_DYNLOADING
+#endif
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/osl/detail/component-mapping.h b/include/osl/detail/component-mapping.h
index 9feae70..df00726 100644
--- a/include/osl/detail/component-mapping.h
+++ b/include/osl/detail/component-mapping.h
@@ -29,16 +29,21 @@ extern "C" {
 typedef struct {
     const char *name;
     void * (*component_getFactory_function)(const char *, void *, void *);
-} lib_to_component_mapping;
+} lib_to_factory_mapping;
 
-const lib_to_component_mapping *lo_get_library_map(void);
-const lib_to_component_mapping *lo_get_implementation_map(void);
+typedef struct {
+    const char *name;
+    void * (*constructor_function)(void *, void *);
+} lib_to_constructor_mapping;
+
+const lib_to_factory_mapping *lo_get_factory_map(void);
+const lib_to_constructor_mapping *lo_get_constructor_map(void);
 
 #ifdef __cplusplus
 }
 #endif
 
-#define NON_APP_SPECIFIC_COMPONENT_MAP \
+#define NON_APP_SPECIFIC_FACTORY_MAP \
     { "libintrospectionlo.a", introspection_component_getFactory }, \
     { "libreflectionlo.a", reflection_component_getFactory }, \
     { "libstocserviceslo.a", stocservices_component_getFactory }, \
@@ -60,19 +65,19 @@ const lib_to_component_mapping *lo_get_implementation_map(void);
     { "libvcllo.a", vcl_component_getFactory }, \
     { "libxstor.a", xstor_component_getFactory }, \
 
-#define NON_APP_SPECIFIC_DIRECT_COMPONENT_MAP \
-    { "com.sun.star.comp.extensions.xml.sax.ParserExpat", com_sun_star_comp_extensions_xml_sax_ParserExpat_component_getFactory }, \
-    { "com.sun.star.comp.extensions.xml.sax.FastParser", com_sun_star_comp_extensions_xml_sax_FastParser_component_getFactory }, \
-    { "com.sun.star.comp.stoc.DLLComponentLoader.component.getFactory", com_sun_star_comp_stoc_DLLComponentLoader_component_getFactory }, \
-    { "com.sun.star.comp.stoc.ImplementationRegistration.component.getFactory", com_sun_star_comp_stoc_ImplementationRegistration_component_getFactory }, \
-    { "com.sun.star.comp.stoc.NestedRegistry.component.getFactory", com_sun_star_comp_stoc_NestedRegistry_component_getFactory }, \
-    { "com.sun.star.comp.stoc.ORegistryServiceManager.component.getFactory", com_sun_star_comp_stoc_ORegistryServiceManager_component_getFactory }, \
-    { "com.sun.star.comp.stoc.OServiceManager.component.getFactory", com_sun_star_comp_stoc_OServiceManager_component_getFactory }, \
-    { "com.sun.star.comp.stoc.OServiceManagerWrapper.component.getFactory", com_sun_star_comp_stoc_OServiceManagerWrapper_component_getFactory }, \
-    { "com.sun.star.comp.stoc.SimpleRegistry.component.getFactory", com_sun_star_comp_stoc_SimpleRegistry_component_getFactory }, \
-    { "com.sun.star.extensions.xml.sax.Writer", com_sun_star_extensions_xml_sax_Writer_component_getFactory }, \
-    { "com.sun.star.security.comp.stoc.AccessController.component.getFactory", com_sun_star_security_comp_stoc_AccessController_component_getFactory }, \
-    { "com.sun.star.security.comp.stoc.FilePolicy.component.getFactory", com_sun_star_security_comp_stoc_FilePolicy_component_getFactory }, \
+#define NON_APP_SPECIFIC_CONSTRUCTOR_MAP \
+    { "com_sun_star_comp_extensions_xml_sax_ParserExpat", com_sun_star_comp_extensions_xml_sax_ParserExpat }, \
+    { "com_sun_star_comp_extensions_xml_sax_FastParser", com_sun_star_comp_extensions_xml_sax_FastParser }, \
+    { "com_sun_star_comp_stoc_DLLComponentLoader", com_sun_star_comp_stoc_DLLComponentLoader }, \
+    { "com_sun_star_comp_stoc_ImplementationRegistration", com_sun_star_comp_stoc_ImplementationRegistration }, \
+    { "com_sun_star_comp_stoc_NestedRegistry", com_sun_star_comp_stoc_NestedRegistry }, \
+    { "com_sun_star_comp_stoc_ORegistryServiceManager", com_sun_star_comp_stoc_ORegistryServiceManager }, \
+    { "com_sun_star_comp_stoc_OServiceManager", com_sun_star_comp_stoc_OServiceManager }, \
+    { "com_sun_star_comp_stoc_OServiceManagerWrapper", com_sun_star_comp_stoc_OServiceManagerWrapper }, \
+    { "com_sun_star_comp_stoc_SimpleRegistry", com_sun_star_comp_stoc_SimpleRegistry }, \
+    { "com_sun_star_extensions_xml_sax_Writer", com_sun_star_extensions_xml_sax_Writer }, \
+    { "com_sun_star_security_comp_stoc_AccessController", com_sun_star_security_comp_stoc_AccessController }, \
+    { "com_sun_star_security_comp_stoc_FilePolicy", com_sun_star_security_comp_stoc_FilePolicy }, \
 
 #endif /* DISABLE_DYNLOADING */
 
diff --git a/ios/experimental/LibreOffice/LibreOffice/lo.mm b/ios/experimental/LibreOffice/LibreOffice/lo.mm
index 5da9455..bce3874 100644
--- a/ios/experimental/LibreOffice/LibreOffice/lo.mm
+++ b/ios/experimental/LibreOffice/LibreOffice/lo.mm
@@ -17,11 +17,11 @@
 #include <touch/touch.h>
 
 extern "C"
-const lib_to_component_mapping *
-lo_get_library_map(void)
+const lib_to_factory_mapping *
+lo_get_factory_map(void)
 {
-    static lib_to_component_mapping map[] = {
-        NON_APP_SPECIFIC_COMPONENT_MAP
+    static lib_to_factory_mapping map[] = {
+        NON_APP_SPECIFIC_FACTORY_MAP
         { "libanalysislo.a", analysis_component_getFactory },
         { "libanimcorelo.a", animcore_component_getFactory },
         { "libavmedialo.a", avmedia_component_getFactory },
@@ -82,11 +82,11 @@ lo_get_library_map(void)
 }
 
 extern "C"
-const lib_to_component_mapping *
-lo_get_implementation_map(void)
+const lib_to_constructor_mapping *
+lo_get_constructor_map(void)
 {
-    static lib_to_component_mapping map[] = {
-        NON_APP_SPECIFIC_DIRECT_COMPONENT_MAP
+    static lib_to_constructor_mapping map[] = {
+        NON_APP_SPECIFIC_CONSTRUCTOR_MAP
         { NULL, NULL }
     };
 
diff --git a/ios/experimental/TiledLibreOffice/TiledLibreOffice/lo.mm b/ios/experimental/TiledLibreOffice/TiledLibreOffice/lo.mm
index 074e472..b2bec61 100644
--- a/ios/experimental/TiledLibreOffice/TiledLibreOffice/lo.mm
+++ b/ios/experimental/TiledLibreOffice/TiledLibreOffice/lo.mm
@@ -17,11 +17,11 @@
 #include <touch/touch.h>
 
 extern "C"
-const lib_to_component_mapping *
-lo_get_library_map(void)
+const lib_to_factory_mapping *
+lo_get_libmap(void)
 {
-    static lib_to_component_mapping map[] = {
-        NON_APP_SPECIFIC_COMPONENT_MAP
+    static lib_to_factory_mapping map[] = {
+        NON_APP_SPECIFIC_FACTORY_MAP
         { "libanalysislo.a", analysis_component_getFactory },
         { "libanimcorelo.a", animcore_component_getFactory },
         { "libavmedialo.a", avmedia_component_getFactory },
@@ -82,11 +82,11 @@ lo_get_library_map(void)
 }
 
 extern "C"
-const lib_to_component_mapping *
-lo_get_implementation_map(void)
+const lib_to_constructor_mapping *
+lo_get_constructor_map(void)
 {
-    static lib_to_component_mapping map[] = {
-        NON_APP_SPECIFIC_DIRECT_COMPONENT_MAP
+    static lib_to_constructor_mapping map[] = {
+        NON_APP_SPECIFIC_CONSTRUCTOR_MAP
         { NULL, NULL }
     };
 
diff --git a/ios/qa/sc/filters-test.m b/ios/qa/sc/filters-test.m
index c1dade9..e732687 100644
--- a/ios/qa/sc/filters-test.m
+++ b/ios/qa/sc/filters-test.m
@@ -29,10 +29,10 @@ extern void * sc_component_getFactory( const char * pImplName, void * pServiceMa
 extern void * scfilt_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
 extern void * unoxml_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
 
-const lib_to_component_mapping *
+const lib_to_factory_mapping *
 lo_get_libmap(void)
 {
-    static lib_to_component_mapping map[] = {
+    static lib_to_factory_mapping map[] = {
         { "libanalysislo.a", analysis_component_getFactory },
         { "libdatelo.a", date_component_getFactory },
         { "libscfiltlo.a", scfilt_component_getFactory },
diff --git a/ios/shared/ios_sharedlo/cxx/mlo.mm b/ios/shared/ios_sharedlo/cxx/mlo.mm
index 6dc4ad1..a9a5eff 100644
--- a/ios/shared/ios_sharedlo/cxx/mlo.mm
+++ b/ios/shared/ios_sharedlo/cxx/mlo.mm
@@ -23,11 +23,11 @@
 #define MAP_LIB_LO_1(LIB) { "lib" #LIB "lo.a", LIB##1_component_getFactory }
 
 extern "C"
-const lib_to_component_mapping *
-lo_get_library_map(void)
+const lib_to_factory_mapping *
+lo_get_factory_map(void)
 {
-    static lib_to_component_mapping map[] = {
-        NON_APP_SPECIFIC_COMPONENT_MAP
+    static lib_to_factory_mapping map[] = {
+        NON_APP_SPECIFIC_FACTORY_MAP
 
         //from IOS
         
@@ -74,11 +74,11 @@ lo_get_library_map(void)
 }
 
 extern "C"
-const lib_to_component_mapping *
-lo_get_implementation_map(void)
+const lib_to_constructor_mapping *
+lo_get_constructor_map(void)
 {
-    static lib_to_component_mapping map[] = {
-        NON_APP_SPECIFIC_DIRECT_COMPONENT_MAP
+    static lib_to_constructor_mapping map[] = {
+        NON_APP_SPECIFIC_CONSTRUCTOR_MAP
         { NULL, NULL }
     };
 
diff --git a/sax/source/expatwrap/expwrap.component b/sax/source/expatwrap/expwrap.component
index 9365a6d..306e517 100644
--- a/sax/source/expatwrap/expwrap.component
+++ b/sax/source/expatwrap/expwrap.component
@@ -18,14 +18,17 @@
  -->
 
 <component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@"
-    prefix="direct" xmlns="http://openoffice.org/2010/uno-components">
-  <implementation name="com.sun.star.comp.extensions.xml.sax.ParserExpat">
+    xmlns="http://openoffice.org/2010/uno-components">
+  <implementation name="com.sun.star.comp.extensions.xml.sax.ParserExpat"
+      constructor="com_sun_star_comp_extensions_xml_sax_ParserExpat">
     <service name="com.sun.star.xml.sax.Parser"/>
   </implementation>
-  <implementation name="com.sun.star.extensions.xml.sax.Writer">
+  <implementation name="com.sun.star.extensions.xml.sax.Writer"
+      constructor="com_sun_star_extensions_xml_sax_Writer">
     <service name="com.sun.star.xml.sax.Writer"/>
   </implementation>
-  <implementation name="com.sun.star.comp.extensions.xml.sax.FastParser">
+  <implementation name="com.sun.star.comp.extensions.xml.sax.FastParser"
+      constructor="com_sun_star_comp_extensions_xml_sax_FastParser">
      <service name="com.sun.star.xml.sax.FastParser"/>
   </implementation>
 </component>
diff --git a/sax/source/expatwrap/sax_expat.cxx b/sax/source/expatwrap/sax_expat.cxx
index 4f00ad9..981d68e 100644
--- a/sax/source/expatwrap/sax_expat.cxx
+++ b/sax/source/expatwrap/sax_expat.cxx
@@ -19,6 +19,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <sal/alloca.h>
+#include <cassert>
 #include <vector>
 
 #include <osl/diagnose.h>
@@ -30,7 +31,6 @@
 #include <com/sun/star/xml/sax/SAXParseException.hpp>
 #include <com/sun/star/io/XSeekable.hpp>
 
-#include <cppuhelper/factory.hxx>
 #include <cppuhelper/weak.hxx>
 #include <cppuhelper/implbase3.hxx>
 #include <cppuhelper/supportsservice.hxx>
@@ -42,13 +42,16 @@ using namespace ::osl;
 using namespace ::cppu;
 using namespace ::com::sun::star::uno;
 using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::registry;
 using namespace ::com::sun::star::xml::sax;
 using namespace ::com::sun::star::io;
 
 #include "attrlistimpl.hxx"
 #include "xml2utf.hxx"
 
+namespace com { namespace sun { namespace star { namespace uno {
+    class XComponentContext;
+} } } }
+
 namespace {
 
 // Useful macros for correct String conversion depending on the choosen expat-mode
@@ -129,17 +132,6 @@ OUString XmlChar2OUString( const XML_Char *p )
 
 class SaxExpatParser_Impl;
 
-OUString SaxExpatParser_getImplementationName() {
-    return OUString("com.sun.star.comp.extensions.xml.sax.ParserExpat");
-}
-
-Sequence< OUString > SaxExpatParser_getSupportedServiceNames(void)
-{
-    Sequence<OUString> seq(1);
-    seq[0] = OUString("com.sun.star.xml.sax.Parser");
-    return seq;
-}
-
 // This class implements the external Parser interface
 class SaxExpatParser
     : public WeakImplHelper3< XInitialization
@@ -598,7 +590,7 @@ void SaxExpatParser::setLocale( const Locale & locale ) throw (RuntimeException)
 // XServiceInfo
 OUString SaxExpatParser::getImplementationName() throw ()
 {
-    return SaxExpatParser_getImplementationName();
+    return OUString("com.sun.star.comp.extensions.xml.sax.ParserExpat");
 }
 
 // XServiceInfo
@@ -610,7 +602,9 @@ sal_Bool SaxExpatParser::supportsService(const OUString& ServiceName) throw ()
 // XServiceInfo
 Sequence< OUString > SaxExpatParser::getSupportedServiceNames(void) throw ()
 {
-    return SaxExpatParser_getSupportedServiceNames();
+    Sequence<OUString> seq(1);
+    seq[0] = "com.sun.star.xml.sax.Parser";
+    return seq;
 }
 
 
@@ -1023,27 +1017,18 @@ void SaxExpatParser_Impl::callbackEndCDATA( void *pvThis )
     CALL_ELEMENT_HANDLER_AND_CARE_FOR_EXCEPTIONS(pImpl,rExtendedDocumentHandler->endCDATA() );
 }
 
-Reference< XInterface > SAL_CALL SaxExpatParser_CreateInstance(
-    SAL_UNUSED_PARAMETER const Reference<css::uno::XComponentContext> & )
-    SAL_THROW((css::uno::Exception))
-{
-    SaxExpatParser *p = new SaxExpatParser;
-    return Reference< XInterface > ( (OWeakObject * ) p );
-}
-
 } // namespace
 
-extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL
-com_sun_star_comp_extensions_xml_sax_ParserExpat_component_getFactory(
-    const char *, void *, void * )
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
+com_sun_star_comp_extensions_xml_sax_ParserExpat(
+    SAL_UNUSED_PARAMETER css::uno::XComponentContext *,
+    uno_Sequence * arguments)
 {
-    Reference<css::lang::XSingleComponentFactory> xFactory(
-        cppu::createSingleComponentFactory(
-            &SaxExpatParser_CreateInstance,
-            SaxExpatParser_getImplementationName(),
-            SaxExpatParser_getSupportedServiceNames()));
-    xFactory->acquire();
-    return xFactory.get();
+    assert(arguments != 0 && arguments->nElements == 0); (void) arguments;
+    css::uno::Reference<css::uno::XInterface> x(
+        static_cast<cppu::OWeakObject *>(new SaxExpatParser));
+    x->acquire();
+    return x.get();
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sax/source/expatwrap/saxwriter.cxx b/sax/source/expatwrap/saxwriter.cxx
index b17f378..6279640 100644
--- a/sax/source/expatwrap/saxwriter.cxx
+++ b/sax/source/expatwrap/saxwriter.cxx
@@ -19,8 +19,9 @@
 
 #include <string.h>
 
-#include <stack>
+#include <cassert>
 #include <set>
+#include <stack>
 
 #include <com/sun/star/lang/XServiceInfo.hpp>
 #include <com/sun/star/util/XCloneable.hpp>
@@ -31,7 +32,6 @@
 
 #include <com/sun/star/io/XActiveDataSource.hpp>
 
-#include <cppuhelper/factory.hxx>
 #include <cppuhelper/weak.hxx>
 #include <cppuhelper/implbase2.hxx>
 #include <cppuhelper/supportsservice.hxx>
@@ -46,13 +46,16 @@ using namespace ::osl;
 using namespace ::cppu;
 using namespace ::com::sun::star::uno;
 using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::registry;
 using namespace ::com::sun::star::xml::sax;
 using namespace ::com::sun::star::util;
 using namespace ::com::sun::star::io;
 
 #include "xml2utf.hxx"
 
+namespace com { namespace sun { namespace star { namespace uno {
+    class XComponentContext;
+} } } }
+
 #define LINEFEED 10
 #define SEQUENCESIZE 1024
 #define MAXCOLUMNCOUNT 72
@@ -867,17 +870,6 @@ static inline sal_Int32 getFirstLineBreak( const OUString & str ) throw ()
     return -1;
 }
 
-OUString SAXWriter_getImplementationName() {
-    return OUString("com.sun.star.extensions.xml.sax.Writer");
-}
-
-Sequence< OUString > SAXWriter_getSupportedServiceNames(void) throw ()
-{
-    Sequence<OUString> seq(1);
-    seq.getArray()[0] = OUString("com.sun.star.xml.sax.Writer");
-    return seq;
-}
-
 class SAXWriter :
     public WeakImplHelper2<
             XWriter,
@@ -998,7 +990,7 @@ static inline sal_Bool isFirstCharWhitespace( const sal_Unicode *p ) throw()
 // XServiceInfo
 OUString SAXWriter::getImplementationName() throw()
 {
-    return SAXWriter_getImplementationName();
+    return OUString("com.sun.star.extensions.xml.sax.Writer");
 }
 
 // XServiceInfo
@@ -1010,7 +1002,9 @@ sal_Bool SAXWriter::supportsService(const OUString& ServiceName) throw()
 // XServiceInfo
 Sequence< OUString > SAXWriter::getSupportedServiceNames(void) throw ()
 {
-    return SAXWriter_getSupportedServiceNames();
+    Sequence<OUString> seq(1);
+    seq[0] = "com.sun.star.xml.sax.Writer";
+    return seq;
 }
 
 void SAXWriter::startDocument()                     throw(SAXException, RuntimeException )
@@ -1376,26 +1370,18 @@ void SAXWriter::unknown(const OUString& sString) throw (SAXException, RuntimeExc
     }
 }
 
-Reference < XInterface > SAL_CALL SAXWriter_CreateInstance(
-    SAL_UNUSED_PARAMETER const Reference<css::uno::XComponentContext> & )
-    SAL_THROW((css::uno::Exception))
-{
-    SAXWriter *p = new SAXWriter;
-    return Reference< XInterface > ( (static_cast< OWeakObject * >(p)) );
-}
-
 } // namespace
 
-extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL
-com_sun_star_extensions_xml_sax_Writer_component_getFactory(
-    const char *, void *, void * )
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
+com_sun_star_extensions_xml_sax_Writer(
+    SAL_UNUSED_PARAMETER css::uno::XComponentContext *,
+    uno_Sequence * arguments)
 {
-    Reference<css::lang::XSingleComponentFactory > xFactory(
-        cppu::createSingleComponentFactory(
-            &SAXWriter_CreateInstance, SAXWriter_getImplementationName(),
-            SAXWriter_getSupportedServiceNames()));
-    xFactory->acquire();
-    return xFactory.get();
+    assert(arguments != 0 && arguments->nElements == 0); (void) arguments;
+    css::uno::Reference<css::uno::XInterface> x(
+        static_cast<cppu::OWeakObject *>(new SAXWriter));
+    x->acquire();
+    return x.get();
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sax/source/fastparser/fastparser.cxx b/sax/source/fastparser/fastparser.cxx
index 8d17b65..04cfbee 100644
--- a/sax/source/fastparser/fastparser.cxx
+++ b/sax/source/fastparser/fastparser.cxx
@@ -27,7 +27,6 @@
 #include <com/sun/star/xml/sax/XFastContextHandler.hpp>
 #include <com/sun/star/xml/sax/XFastDocumentHandler.hpp>
 #include <com/sun/star/xml/sax/XFastTokenHandler.hpp>
-#include <cppuhelper/factory.hxx>
 #include <cppuhelper/supportsservice.hxx>
 #include <osl/conditn.hxx>
 #include <osl/diagnose.h>
@@ -42,9 +41,14 @@
 #include <stack>
 #include <vector>
 #include <queue>
+#include <cassert>
 #include <cstring>
 #include <expat.h>
 
+namespace com { namespace sun { namespace star { namespace uno {
+    class XComponentContext;
+} } } }
+
 using namespace ::std;
 using namespace ::osl;
 using namespace ::cppu;
@@ -57,17 +61,6 @@ using namespace sax_fastparser;
 
 namespace {
 
-OUString FastSaxParser_getImplementationName() {
-    return OUString("com.sun.star.comp.extensions.xml.sax.FastParser");
-}
-
-uno::Sequence<OUString> FastSaxParser_getSupportedServiceNames()
-{
-    Sequence<OUString> seq(1);
-    seq.getArray()[0] = OUString("com.sun.star.xml.sax.FastParser");
-    return seq;
-}
-
 struct Event;
 class FastLocatorImpl;
 struct NamespaceDefine;
@@ -1404,7 +1397,7 @@ void FastSaxParser::setLocale( const lang::Locale& rLocale )
 OUString FastSaxParser::getImplementationName()
     throw (uno::RuntimeException)
 {
-    return FastSaxParser_getImplementationName();
+    return OUString("com.sun.star.comp.extensions.xml.sax.FastParser");
 }
 
 sal_Bool FastSaxParser::supportsService( const OUString& ServiceName )
@@ -1416,7 +1409,9 @@ sal_Bool FastSaxParser::supportsService( const OUString& ServiceName )
 uno::Sequence<OUString> FastSaxParser::getSupportedServiceNames()
     throw (uno::RuntimeException)
 {
-    return FastSaxParser_getSupportedServiceNames();
+    Sequence<OUString> seq(1);
+    seq[0] = OUString("com.sun.star.xml.sax.FastParser");
+    return seq;
 }
 
 bool FastSaxParser::hasNamespaceURL( const OUString& rPrefix ) const
@@ -1426,25 +1421,16 @@ bool FastSaxParser::hasNamespaceURL( const OUString& rPrefix ) const
 
 } // namespace sax_fastparser
 
-static Reference< XInterface > SAL_CALL FastSaxParser_CreateInstance(
-    SAL_UNUSED_PARAMETER const Reference<css::uno::XComponentContext> & )
-    SAL_THROW((css::uno::Exception))
-{
-    FastSaxParser *p = new FastSaxParser;
-    return Reference< XInterface > ( (OWeakObject * ) p );
-}
-
-extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL
-com_sun_star_comp_extensions_xml_sax_FastParser_component_getFactory(
-    const char *, void *, void * )
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
+com_sun_star_comp_extensions_xml_sax_FastParser(
+    SAL_UNUSED_PARAMETER css::uno::XComponentContext *,
+    uno_Sequence * arguments)
 {
-    Reference<css::lang::XSingleComponentFactory> xFactory(
-        cppu::createSingleComponentFactory(
-            &FastSaxParser_CreateInstance,
-            FastSaxParser_getImplementationName(),
-            FastSaxParser_getSupportedServiceNames()));
-    xFactory->acquire();
-    return xFactory.get();
+    assert(arguments != 0 && arguments->nElements == 0); (void) arguments;
+    css::uno::Reference<css::uno::XInterface> x(
+        static_cast<cppu::OWeakObject *>(new FastSaxParser));
+    x->acquire();
+    return x.get();
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/stoc/source/defaultregistry/defaultregistry.cxx b/stoc/source/defaultregistry/defaultregistry.cxx
index 7074683..285e379 100644
--- a/stoc/source/defaultregistry/defaultregistry.cxx
+++ b/stoc/source/defaultregistry/defaultregistry.cxx
@@ -21,7 +21,6 @@
 #include <osl/diagnose.h>
 #include <cppuhelper/queryinterface.hxx>
 #include <cppuhelper/weak.hxx>
-#include <cppuhelper/factory.hxx>
 #include <cppuhelper/implbase1.hxx>
 #include <cppuhelper/implbase4.hxx>
 #include <cppuhelper/implbase3.hxx>
@@ -44,13 +43,6 @@ using namespace com::sun::star::container;
 using namespace cppu;
 using namespace osl;
 
-static Sequence< OUString > NestedRegistryImpl_getSupportedServiceNames()
-{
-    Sequence< OUString > seqNames(1);
-    seqNames.getArray()[0] = OUString("com.sun.star.registry.NestedRegistry");
-    return seqNames;
-}
-
 namespace {
 
 class NestedKeyImpl;
@@ -1207,7 +1199,9 @@ sal_Bool SAL_CALL NestedRegistryImpl::supportsService( const OUString& ServiceNa
 Sequence<OUString> SAL_CALL NestedRegistryImpl::getSupportedServiceNames(  )
     throw(RuntimeException)
 {
-    return NestedRegistryImpl_getSupportedServiceNames();
+    Sequence< OUString > seqNames(1);
+    seqNames[0] = "com.sun.star.registry.NestedRegistry";
+    return seqNames;
 }
 
 //*************************************************************************
@@ -1355,32 +1349,16 @@ void SAL_CALL NestedRegistryImpl::mergeKey( const OUString& aKeyName, const OUSt
 
 } // namespace
 
-static Reference<XInterface> NestedRegistry_CreateInstance(
-    SAL_UNUSED_PARAMETER const Reference<XComponentContext>& )
-    throw(Exception)
-{
-    Reference<XInterface>   xRet;
-    XSimpleRegistry *pRegistry = (XSimpleRegistry*) new NestedRegistryImpl;
-
-    if (pRegistry)
-    {
-        xRet = Reference<XInterface>::query(pRegistry);
-    }
-
-    return xRet;
-}
-
-extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL
-com_sun_star_comp_stoc_NestedRegistry_component_getFactory(
-    const char * , void * , void * )
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
+com_sun_star_comp_stoc_NestedRegistry(
+    SAL_UNUSED_PARAMETER css::uno::XComponentContext *,
+    uno_Sequence * arguments)
 {
-    Reference< XSingleComponentFactory > xFactory;
-    xFactory = createSingleComponentFactory(
-            NestedRegistry_CreateInstance,
-            "com.sun.star.comp.stoc.NestedRegistry",
-            NestedRegistryImpl_getSupportedServiceNames() );
-    xFactory->acquire();
-    return xFactory.get();
+    assert(arguments != 0 && arguments->nElements == 0); (void) arguments;
+    css::uno::Reference<css::uno::XInterface> x(
+        static_cast<cppu::OWeakObject *>(new NestedRegistryImpl));
+    x->acquire();
+    return x.get();
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/stoc/source/implementationregistration/implreg.cxx b/stoc/source/implementationregistration/implreg.cxx
index 4e8e697..3490320 100644
--- a/stoc/source/implementationregistration/implreg.cxx
+++ b/stoc/source/implementationregistration/implreg.cxx
@@ -22,7 +22,6 @@
 #include <list>
 
 #include <cppuhelper/queryinterface.hxx>
-#include <cppuhelper/factory.hxx>
 #include <cppuhelper/weak.hxx>
 #include <cppuhelper/implbase3.hxx>
 #include <cppuhelper/implementationentry.hxx>
@@ -63,9 +62,6 @@ using namespace com::sun::star::registry;
 using namespace cppu;
 using namespace osl;
 
-#define IMPLNAME "com.sun.star.comp.stoc.ImplementationRegistration"
-#define SERVICENAME         "com.sun.star.registry.ImplementationRegistration"
-
 namespace {
 
 struct StringPool
@@ -113,13 +109,6 @@ const StringPool &spool()
     return *pPool;
 }
 
-static Sequence< OUString > ImplementationRegistration_getSupportedServiceNames()
-{
-    Sequence< OUString > seqNames(1);
-    seqNames.getArray()[0] = SERVICENAME;
-    return seqNames;
-}
-
 //*************************************************************************
 //  static deleteAllLinkReferences()
 //
@@ -1309,7 +1298,7 @@ ImplementationRegistration::~ImplementationRegistration() {}
 // XServiceInfo
 OUString ImplementationRegistration::getImplementationName() throw(RuntimeException)
 {
-    return OUString(IMPLNAME);
+    return OUString("com.sun.star.comp.stoc.ImplementationRegistration");
 }
 
 // XServiceInfo
@@ -1321,7 +1310,9 @@ sal_Bool ImplementationRegistration::supportsService(const OUString& ServiceName
 // XServiceInfo
 Sequence< OUString > ImplementationRegistration::getSupportedServiceNames(void) throw(RuntimeException)
 {
-    return ImplementationRegistration_getSupportedServiceNames();
+    Sequence< OUString > seqNames(1);
+    seqNames[0] = "com.sun.star.registry.ImplementationRegistration";
+    return seqNames;
 }
 
 Reference< XSimpleRegistry > ImplementationRegistration::getRegistryFromServiceManager()
@@ -1825,23 +1816,16 @@ Reference< XSimpleRegistry > ImplementationRegistration::createTemporarySimpleRe
 
 }
 
-static Reference<XInterface> ImplementationRegistration_CreateInstance(
-    const Reference<XComponentContext> & xCtx ) // throw(Exception)
-{
-    return (XImplementationRegistration *)new ImplementationRegistration(xCtx);
-}
-
-extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL
-com_sun_star_comp_stoc_ImplementationRegistration_component_getFactory(
-    const char * , void * , void * )
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
+com_sun_star_comp_stoc_ImplementationRegistration(
+    css::uno::XComponentContext * context, uno_Sequence * arguments)
 {
-    Reference< css::lang::XSingleComponentFactory > xFactory;
-    xFactory = createSingleComponentFactory(
-            ImplementationRegistration_CreateInstance,
-            IMPLNAME,
-            ImplementationRegistration_getSupportedServiceNames() );
-    xFactory->acquire();
-    return xFactory.get();
+    assert(arguments != 0 && arguments->nElements == 0); (void) arguments;
+    css::uno::Reference<css::uno::XInterface> x(
+        static_cast<cppu::OWeakObject *>(
+            new ImplementationRegistration(context)));
+    x->acquire();
+    return x.get();
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/stoc/source/loader/dllcomponentloader.cxx b/stoc/source/loader/dllcomponentloader.cxx
index 402ed4a..d4ab87f 100644
--- a/stoc/source/loader/dllcomponentloader.cxx
+++ b/stoc/source/loader/dllcomponentloader.cxx
@@ -29,7 +29,6 @@
 #include <uno/mapping.hxx>
 #include <cppuhelper/queryinterface.hxx>
 #include <cppuhelper/weak.hxx>
-#include <cppuhelper/factory.hxx>
 #include <cppuhelper/shlib.hxx>
 #include <cppuhelper/implbase3.hxx>
 #include <cppuhelper/implementationentry.hxx>
@@ -42,10 +41,6 @@
 #include <com/sun/star/lang/XInitialization.hpp>
 #include <com/sun/star/registry/XRegistryKey.hpp>
 
-#define SERVICENAME "com.sun.star.loader.SharedLibrary"
-#define IMPLNAME    "com.sun.star.comp.stoc.DLLComponentLoader"
-
-
 using namespace com::sun::star;
 using namespace com::sun::star::uno;
 using namespace com::sun::star::loader;
@@ -56,13 +51,6 @@ using namespace osl;
 
 namespace {
 
-static Sequence< OUString > DllComponentLoader_getSupportedServiceNames()
-{
-    Sequence< OUString > seqNames(1);
-    seqNames.getArray()[0] = OUString(SERVICENAME);
-    return seqNames;
-}
-
 class DllComponentLoader
     : public WeakImplHelper3< XImplementationLoader,
                               XInitialization,
@@ -101,7 +89,7 @@ DllComponentLoader::~DllComponentLoader() {}
 OUString SAL_CALL DllComponentLoader::getImplementationName(  )
     throw(::com::sun::star::uno::RuntimeException)
 {
-    return OUString(IMPLNAME);
+    return OUString("com.sun.star.comp.stoc.DLLComponentLoader");
 }
 
 sal_Bool SAL_CALL DllComponentLoader::supportsService( const OUString& ServiceName )
@@ -113,7 +101,9 @@ sal_Bool SAL_CALL DllComponentLoader::supportsService( const OUString& ServiceNa
 Sequence<OUString> SAL_CALL DllComponentLoader::getSupportedServiceNames(  )
     throw(::com::sun::star::uno::RuntimeException)
 {
-    return DllComponentLoader_getSupportedServiceNames();
+    Sequence< OUString > seqNames(1);
+    seqNames[0] = "com.sun.star.loader.SharedLibrary";
+    return seqNames;
 }
 
 //*************************************************************************
@@ -174,32 +164,15 @@ sal_Bool SAL_CALL DllComponentLoader::writeRegistryInfo(
 
 }
 
-static Reference<XInterface> DllComponentLoader_CreateInstance(
-        const Reference<XComponentContext> & xCtx ) throw(Exception)
-{
-    Reference<XInterface> xRet;
-
-    XImplementationLoader *pXLoader = (XImplementationLoader *)new DllComponentLoader(xCtx);
-
-    if (pXLoader)
-    {
-        xRet = Reference<XInterface>::query(pXLoader);
-    }
-
-    return xRet;
-}
-
-extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL
-com_sun_star_comp_stoc_DLLComponentLoader_component_getFactory(
-    const char * , void * , void * )
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
+com_sun_star_comp_stoc_DLLComponentLoader(
+    css::uno::XComponentContext * context, uno_Sequence * arguments)
 {
-    Reference< css::lang::XSingleComponentFactory > xFactory;
-    xFactory = createSingleComponentFactory(
-            DllComponentLoader_CreateInstance,
-            IMPLNAME,
-            DllComponentLoader_getSupportedServiceNames() );
-    xFactory->acquire();
-    return xFactory.get();
+    assert(arguments != 0 && arguments->nElements == 0); (void) arguments;
+    css::uno::Reference<css::uno::XInterface> x(
+        static_cast<cppu::OWeakObject *>(new DllComponentLoader(context)));
+    x->acquire();
+    return x.get();
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/stoc/source/security/access_controller.cxx b/stoc/source/security/access_controller.cxx
index 6de5cce..07e3b58 100644
--- a/stoc/source/security/access_controller.cxx
+++ b/stoc/source/security/access_controller.cxx
@@ -34,7 +34,6 @@
 
 #include <cppuhelper/implbase1.hxx>
 #include <cppuhelper/compbase3.hxx>
-#include <cppuhelper/factory.hxx>
 #include <cppuhelper/implementationentry.hxx>
 #include <cppuhelper/supportsservice.hxx>
 
@@ -52,7 +51,6 @@
 
 
 #define SERVICE_NAME "com.sun.star.security.AccessController"
-#define IMPL_NAME "com.sun.star.security.comp.stoc.AccessController"
 #define USER_CREDS "access-control.user-credentials"
 
 
@@ -962,7 +960,7 @@ Reference< security::XAccessControlContext > AccessController::getContext()
 OUString AccessController::getImplementationName()
     throw (RuntimeException)
 {
-    return OUString(IMPL_NAME);
+    return OUString("com.sun.star.security.comp.stoc.AccessController");
 }
 //__________________________________________________________________________________________________
 sal_Bool AccessController::supportsService( OUString const & serviceName )
@@ -971,39 +969,25 @@ sal_Bool AccessController::supportsService( OUString const & serviceName )
     return cppu::supportsService(this, serviceName);
 }
 //__________________________________________________________________________________________________
-static Sequence< OUString > AccessController_getSupportedServiceNames()
-{
-    Sequence< OUString > aSNS( 1 );
-    aSNS.getArray()[0] = OUString(SERVICE_NAME);
-    return aSNS;
-}
-
 Sequence< OUString > AccessController::getSupportedServiceNames()
     throw (RuntimeException)
 {
-    return AccessController_getSupportedServiceNames();
+    Sequence< OUString > aSNS( 1 );
+    aSNS[0] = OUString(SERVICE_NAME);
+    return aSNS;
 }
 
 }
 
-static Reference< XInterface > SAL_CALL AccessController_create(
-    Reference< XComponentContext > const & xComponentContext )
-    SAL_THROW( (Exception) )
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
+com_sun_star_security_comp_stoc_AccessController(
+    css::uno::XComponentContext * context, uno_Sequence * arguments)
 {
-    return (OWeakObject *)new AccessController( xComponentContext );
-}
-
-extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL
-com_sun_star_security_comp_stoc_AccessController_component_getFactory(
-    const char * , void * , void * )
-{
-    Reference< css::lang::XSingleComponentFactory > xFactory;
-    xFactory = createSingleComponentFactory(
-            AccessController_create,
-            IMPL_NAME,
-            AccessController_getSupportedServiceNames() );
-    xFactory->acquire();
-    return xFactory.get();
+    assert(arguments != 0 && arguments->nElements == 0); (void) arguments;
+    css::uno::Reference<css::uno::XInterface> x(
+        static_cast<cppu::OWeakObject *>(new AccessController(context)));
+    x->acquire();
+    return x.get();
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/stoc/source/security/file_policy.cxx b/stoc/source/security/file_policy.cxx
index 4d51240..7d0ad08 100644
--- a/stoc/source/security/file_policy.cxx
+++ b/stoc/source/security/file_policy.cxx
@@ -39,7 +39,6 @@
 #include <com/sun/star/io/FilePermission.hpp>
 #include <com/sun/star/connection/SocketPermission.hpp>
 
-#define SERVICE_NAME "com.sun.star.security.Policy"
 #define IMPL_NAME "com.sun.star.security.comp.stoc.FilePolicy"
 
 using namespace ::osl;
@@ -532,39 +531,25 @@ sal_Bool FilePolicy::supportsService( OUString const & serviceName )
     return cppu::supportsService(this, serviceName);
 }
 //__________________________________________________________________________________________________
-static Sequence< OUString > FilePolicy_getSupportedServiceNames() SAL_THROW(())
-{
-    Sequence< OUString > aSNS( 1 );
-    aSNS.getArray()[0] = OUString(SERVICE_NAME);
-    return aSNS;
-}
-
 Sequence< OUString > FilePolicy::getSupportedServiceNames()
     throw (RuntimeException)
 {
-    return FilePolicy_getSupportedServiceNames();
+    Sequence< OUString > aSNS( 1 );
+    aSNS[0] = OUString("com.sun.star.security.Policy");
+    return aSNS;
 }
 
 } // namespace
 
-static Reference< XInterface > FilePolicy_CreateInstance(
-    Reference< XComponentContext > const & xComponentContext )
-    SAL_THROW( (Exception) )
-{
-    return (OWeakObject *)new FilePolicy( xComponentContext );
-}
-
-extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL
-com_sun_star_security_comp_stoc_FilePolicy_component_getFactory(
-    const char * , void * , void * )
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
+com_sun_star_security_comp_stoc_FilePolicy(
+    css::uno::XComponentContext * context, uno_Sequence * arguments)
 {
-    Reference< css::lang::XSingleComponentFactory > xFactory;
-    xFactory = createSingleComponentFactory(
-            FilePolicy_CreateInstance,
-            IMPL_NAME,
-            FilePolicy_getSupportedServiceNames() );
-    xFactory->acquire();
-    return xFactory.get();
+    assert(arguments != 0 && arguments->nElements == 0); (void) arguments;
+    css::uno::Reference<css::uno::XInterface> x(
+        static_cast<cppu::OWeakObject *>(new FilePolicy(context)));
+    x->acquire();
+    return x.get();
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/stoc/source/servicemanager/servicemanager.cxx b/stoc/source/servicemanager/servicemanager.cxx
index 97eda24..9c96a78 100644
--- a/stoc/source/servicemanager/servicemanager.cxx
+++ b/stoc/source/servicemanager/servicemanager.cxx
@@ -28,7 +28,6 @@
 #include <cppuhelper/queryinterface.hxx>
 #include <cppuhelper/weakref.hxx>
 #include <cppuhelper/component.hxx>
-#include <cppuhelper/factory.hxx>
 #include <cppuhelper/implbase1.hxx>
 #include <cppuhelper/implementationentry.hxx>
 #include <cppuhelper/component_context.hxx>
@@ -67,29 +66,6 @@ using namespace std;
 
 namespace {
 
-Sequence< OUString > OServiceManager_getSupportedServiceNames()
-{
-    Sequence< OUString > seqNames(2);
-    seqNames.getArray()[0] = "com.sun.star.lang.MultiServiceFactory";
-    seqNames.getArray()[1] = "com.sun.star.lang.ServiceManager";
-    return seqNames;
-}
-
-Sequence< OUString > ORegistryServiceManager_getSupportedServiceNames()
-{
-    Sequence< OUString > seqNames(2);
-    seqNames.getArray()[0] = "com.sun.star.lang.MultiServiceFactory";
-    seqNames.getArray()[1] = "com.sun.star.lang.RegistryServiceManager";
-    return seqNames;
-}
-
-Sequence< OUString > OServiceManagerWrapper_getSupportedServiceNames()
-{
-    Sequence< OUString > seqNames(1);
-    seqNames.getArray()[0] = "com.sun.star.lang.MultiServiceFactory";
-    return seqNames;
-}
-
 static Sequence< OUString > retrieveAsciiValueList(
     const Reference< XSimpleRegistry > &xReg, const OUString &keyName )
 {
@@ -1083,7 +1059,6 @@ void OServiceManager::initialize( Sequence< Any > const & )
 OUString OServiceManager::getImplementationName()
     throw(::com::sun::star::uno::RuntimeException)
 {
-    check_undisposed();
     return OUString("com.sun.star.comp.stoc.OServiceManager");
 }
 
@@ -1098,8 +1073,10 @@ sal_Bool OServiceManager::supportsService(const OUString& ServiceName)
 Sequence< OUString > OServiceManager::getSupportedServiceNames()
     throw(::com::sun::star::uno::RuntimeException)
 {
-    check_undisposed();
-    return  OServiceManager_getSupportedServiceNames();
+    Sequence< OUString > seqNames(2);
+    seqNames[0] = "com.sun.star.lang.MultiServiceFactory";
+    seqNames[1] = "com.sun.star.lang.ServiceManager";
+    return seqNames;
 }
 
 
@@ -1601,8 +1578,10 @@ Sequence< OUString > ORegistryServiceManager::getAvailableServiceNames()
 Sequence< OUString > ORegistryServiceManager::getSupportedServiceNames()
     throw(::com::sun::star::uno::RuntimeException)
 {
-    check_undisposed();
-    return ORegistryServiceManager_getSupportedServiceNames();
+    Sequence< OUString > seqNames(2);
+    seqNames[0] = "com.sun.star.lang.MultiServiceFactory";
+    seqNames[1] = "com.sun.star.lang.RegistryServiceManager";
+    return seqNames;
 }
 
 
@@ -1691,67 +1670,37 @@ Any ORegistryServiceManager::getPropertyValue(const OUString& PropertyName)
 
 } // namespace
 
-static Reference<XInterface > OServiceManager_CreateInstance(
-    const Reference< XComponentContext > & xContext )
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
+com_sun_star_comp_stoc_OServiceManager(
+    css::uno::XComponentContext * context, uno_Sequence * arguments)
 {
-    return Reference<XInterface >(
-        static_cast< XInterface * >(
-            static_cast< OWeakObject * >( new OServiceManager( xContext ) ) ) );
-}
-
-extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL
-com_sun_star_comp_stoc_OServiceManager_component_getFactory(
-    const char * , void * , void * )
-{
-    Reference< css::lang::XSingleComponentFactory > xFactory;
-    xFactory = createSingleComponentFactory(
-            OServiceManager_CreateInstance,
-            "com.sun.star.comp.stoc.OServiceManager",
-            OServiceManager_getSupportedServiceNames() );
-    xFactory->acquire();
-    return xFactory.get();
+    assert(arguments != 0 && arguments->nElements == 0); (void) arguments;
+    css::uno::Reference<css::uno::XInterface> x(
+        static_cast<cppu::OWeakObject *>(new OServiceManager(context)));
+    x->acquire();
+    return x.get();
 }
 
-static Reference<XInterface > ORegistryServiceManager_CreateInstance(
-    const Reference< XComponentContext > & xContext )
-    throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException)
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
+com_sun_star_comp_stoc_ORegistryServiceManager(
+    css::uno::XComponentContext * context, uno_Sequence * arguments)
 {
-    return Reference<XInterface >(
-        static_cast< XInterface * >(
-            static_cast< OWeakObject * >( new ORegistryServiceManager( xContext ) ) ) );
-}
-
-extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL
-com_sun_star_comp_stoc_ORegistryServiceManager_component_getFactory(
-    const char * , void * , void * )
-{
-    Reference< css::lang::XSingleComponentFactory > xFactory;
-    xFactory = createSingleComponentFactory(
-            ORegistryServiceManager_CreateInstance,
-            "com.sun.star.comp.stoc.ORegistryServiceManager",
-            ORegistryServiceManager_getSupportedServiceNames() );
-    xFactory->acquire();
-    return xFactory.get();
+    assert(arguments != 0 && arguments->nElements == 0); (void) arguments;
+    css::uno::Reference<css::uno::XInterface> x(
+        static_cast<cppu::OWeakObject *>(new ORegistryServiceManager(context)));
+    x->acquire();
+    return x.get();
 }
 
-static Reference<XInterface > OServiceManagerWrapper_CreateInstance(
-    const Reference< XComponentContext > & xContext )
-    throw (Exception)
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
+com_sun_star_comp_stoc_OServiceManagerWrapper(
+    css::uno::XComponentContext * context, uno_Sequence * arguments)
 {
-    return (OWeakObject *)new OServiceManagerWrapper( xContext );
-}
-
-extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL
-com_sun_star_comp_stoc_OServiceManagerWrapper_component_getFactory(
-    const char * , void * , void * )
-{
-    Reference< css::lang::XSingleComponentFactory > xFactory;
-    xFactory = createSingleComponentFactory(
-            OServiceManagerWrapper_CreateInstance,
-            "com.sun.star.comp.stoc.OServiceManagerWrapper",
-            OServiceManagerWrapper_getSupportedServiceNames() );
-    xFactory->acquire();
-    return xFactory.get();
+    assert(arguments != 0 && arguments->nElements == 0); (void) arguments;
+    css::uno::Reference<css::uno::XInterface> x(
+        static_cast<cppu::OWeakObject *>(new OServiceManagerWrapper(context)));
+    x->acquire();
+    return x.get();
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/stoc/source/simpleregistry/simpleregistry.cxx b/stoc/source/simpleregistry/simpleregistry.cxx
index 80e30da..d1a761b 100644
--- a/stoc/source/simpleregistry/simpleregistry.cxx
+++ b/stoc/source/simpleregistry/simpleregistry.cxx
@@ -34,9 +34,9 @@
 #include "com/sun/star/uno/XComponentContext.hpp"
 #include "com/sun/star/uno/XInterface.hpp"
 #include "com/sun/star/uno/Sequence.hxx"
-#include <cppuhelper/factory.hxx>
 #include "cppuhelper/implbase1.hxx"
 #include "cppuhelper/implbase2.hxx"
+#include "cppuhelper/supportsservice.hxx"
 #include "cppuhelper/weak.hxx"
 #include "osl/mutex.hxx"
 #include "registry/registry.hxx"
@@ -52,12 +52,6 @@
 
 namespace {
 
-static css::uno::Sequence< OUString > SimpleRegistry_getSupportedServiceNames() {
-    css::uno::Sequence< OUString > names(1);
-    names[0] = "com.sun.star.registry.SimpleRegistry";
-    return names;
-}
-
 class SimpleRegistry:
     public cppu::WeakImplHelper2<
         css::registry::XSimpleRegistry, css::lang::XServiceInfo >
@@ -105,11 +99,15 @@ private:
 
     virtual sal_Bool SAL_CALL supportsService(OUString const & ServiceName)
         throw (css::uno::RuntimeException)
-    { return ServiceName == getSupportedServiceNames()[0]; }
+    { return cppu::supportsService(this, ServiceName); }
 
     virtual css::uno::Sequence< OUString > SAL_CALL
     getSupportedServiceNames() throw (css::uno::RuntimeException)
-    { return SimpleRegistry_getSupportedServiceNames(); }
+    {
+        css::uno::Sequence< OUString > names(1);
+        names[0] = "com.sun.star.registry.SimpleRegistry";
+        return names;
+    }
 
     Registry registry_;
 };
@@ -1125,24 +1123,16 @@ void SimpleRegistry::mergeKey(
 
 }
 
-static css::uno::Reference< css::uno::XInterface > SimpleRegistry_CreateInstance(
-    SAL_UNUSED_PARAMETER css::uno::Reference< css::uno::XComponentContext >
-        const &)
-{
-    return static_cast< cppu::OWeakObject * >(new SimpleRegistry);
-}
-
-extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL
-com_sun_star_comp_stoc_SimpleRegistry_component_getFactory(
-    const char * , void * , void * )
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
+com_sun_star_comp_stoc_SimpleRegistry(
+    SAL_UNUSED_PARAMETER css::uno::XComponentContext *,
+    uno_Sequence * arguments)
 {
-    css::uno::Reference< css::lang::XSingleComponentFactory > xFactory;
-    xFactory = cppu::createSingleComponentFactory(
-            SimpleRegistry_CreateInstance,
-            "com.sun.star.comp.stoc.SimpleRegistry",
-            SimpleRegistry_getSupportedServiceNames() );
-    xFactory->acquire();
-    return xFactory.get();
+    assert(arguments != 0 && arguments->nElements == 0); (void) arguments;
+    css::uno::Reference<css::uno::XInterface> x(
+        static_cast<cppu::OWeakObject *>(new SimpleRegistry));
+    x->acquire();
+    return x.get();
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/stoc/util/bootstrap.component b/stoc/util/bootstrap.component
index f06de74..81f622e 100644
--- a/stoc/util/bootstrap.component
+++ b/stoc/util/bootstrap.component
@@ -18,30 +18,39 @@
  -->
 
 <component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@"
-    prefix="direct" xmlns="http://openoffice.org/2010/uno-components">
-  <implementation name="com.sun.star.comp.stoc.DLLComponentLoader">
+    xmlns="http://openoffice.org/2010/uno-components">
+  <implementation name="com.sun.star.comp.stoc.DLLComponentLoader"
+      constructor="com_sun_star_comp_stoc_DLLComponentLoader">
     <service name="com.sun.star.loader.SharedLibrary"/>
   </implementation>
-  <implementation name="com.sun.star.comp.stoc.ImplementationRegistration">
+  <implementation name="com.sun.star.comp.stoc.ImplementationRegistration"
+      constructor="com_sun_star_comp_stoc_ImplementationRegistration">
     <service name="com.sun.star.registry.ImplementationRegistration"/>
   </implementation>
-  <implementation name="com.sun.star.comp.stoc.NestedRegistry">
+  <implementation name="com.sun.star.comp.stoc.NestedRegistry"
+      constructor="com_sun_star_comp_stoc_NestedRegistry">
     <service name="com.sun.star.registry.NestedRegistry"/>
   </implementation>
-  <implementation name="com.sun.star.comp.stoc.ORegistryServiceManager">
+  <implementation name="com.sun.star.comp.stoc.ORegistryServiceManager"
+      constructor="com_sun_star_comp_stoc_ORegistryServiceManager">
     <service name="com.sun.star.lang.RegistryServiceManager"/>
   </implementation>
-  <implementation name="com.sun.star.comp.stoc.OServiceManager">
+  <implementation name="com.sun.star.comp.stoc.OServiceManager"
+      constructor="com_sun_star_comp_stoc_OServiceManager">
     <service name="com.sun.star.lang.ServiceManager"/>
   </implementation>
-  <implementation name="com.sun.star.comp.stoc.OServiceManagerWrapper"/>
-  <implementation name="com.sun.star.comp.stoc.SimpleRegistry">
+  <implementation name="com.sun.star.comp.stoc.OServiceManagerWrapper"
+      constructor="com_sun_star_comp_stoc_OServiceManagerWrapper"/>
+  <implementation name="com.sun.star.comp.stoc.SimpleRegistry"
+      constructor="com_sun_star_comp_stoc_SimpleRegistry">
     <service name="com.sun.star.registry.SimpleRegistry"/>
   </implementation>
-  <implementation name="com.sun.star.security.comp.stoc.AccessController">
+  <implementation name="com.sun.star.security.comp.stoc.AccessController"
+      constructor="com_sun_star_security_comp_stoc_AccessController">
     <service name="com.sun.star.security.AccessController"/>
   </implementation>
-  <implementation name="com.sun.star.security.comp.stoc.FilePolicy">
+  <implementation name="com.sun.star.security.comp.stoc.FilePolicy"
+      constructor="com_sun_star_security_comp_stoc_FilePolicy">
     <service name="com.sun.star.security.Policy"/>
   </implementation>
 </component>


More information about the Libreoffice-commits mailing list