diff options
author | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2011-07-21 18:59:03 +0200 |
---|---|---|
committer | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2011-07-21 18:59:03 +0200 |
commit | 5b5501f54ec560bf7a5e3ac1b1257b6072a69057 (patch) | |
tree | 2735f8af1183f82309d6d21262e613f164be7bf7 /cppuhelper | |
parent | c5235330a83081e6b744d93996f37b3abd6ac30a (diff) | |
parent | a6ba297abbe0a78954de2b2cbd911df899dc985c (diff) |
resyncing to master
Diffstat (limited to 'cppuhelper')
-rw-r--r-- | cppuhelper/inc/cppuhelper/shlib.hxx | 28 | ||||
-rw-r--r-- | cppuhelper/prj/build.lst | 2 | ||||
-rw-r--r-- | cppuhelper/qa/propertysetmixin/comp_propertysetmixin.cxx | 11 | ||||
-rw-r--r-- | cppuhelper/qa/propertysetmixin/makefile.mk | 1 | ||||
-rw-r--r-- | cppuhelper/qa/propertysetmixin/qa_propertysetmixin.cpp.component | 2 | ||||
-rw-r--r-- | cppuhelper/source/factory.cxx | 23 | ||||
-rw-r--r-- | cppuhelper/source/gcc3.map | 1 | ||||
-rw-r--r-- | cppuhelper/source/gcc3os2.map | 1 | ||||
-rwxr-xr-x | cppuhelper/source/makefile.mk | 4 | ||||
-rw-r--r-- | cppuhelper/source/msvc_win32_intel.map | 1 | ||||
-rw-r--r-- | cppuhelper/source/shlib.cxx | 49 | ||||
-rw-r--r-- | cppuhelper/test/cfg_test.cxx | 6 |
12 files changed, 87 insertions, 42 deletions
diff --git a/cppuhelper/inc/cppuhelper/shlib.hxx b/cppuhelper/inc/cppuhelper/shlib.hxx index a092ce34a..ebbc1e1d9 100644 --- a/cppuhelper/inc/cppuhelper/shlib.hxx +++ b/cppuhelper/inc/cppuhelper/shlib.hxx @@ -42,7 +42,7 @@ namespace cppu (e.g. xxx.dll). You can give parameter rPath to force lookup of the library in a specific directory. The resulting path of the library will be checked against environment variable CPLD_ACCESSPATH if set. - + @param rLibName name of the library @param rPath optional path @param rImplName implementation to be retrieved from the library @@ -60,6 +60,32 @@ SAL_CALL loadSharedLibComponentFactory( ::com::sun::star::uno::Reference< ::com::sun::star::registry::XRegistryKey > const & xKey ) SAL_THROW( (::com::sun::star::loader::CannotActivateFactoryException) ); +/** Loads a shared library component and gets the factory out of it. You can give either a + fully qualified libname or single lib name. The libname need not be pre/postfixed + (e.g. xxx.dll). You can give parameter rPath to force lookup of the library in a specific + directory. The resulting path of the library will be checked against environment variable + CPLD_ACCESSPATH if set. An optional 'prefix' parameter is used to determine the symbol + name of the entry point in the library. + + @param rLibName name of the library + @param rPath optional path + @param rImplName implementation to be retrieved from the library + @param xMgr service manager to be provided to the component + @param xKey registry key to be provided to the component + @param rPrefix optional component prefix + @return + factory instance (::com::sun::star::lang::XSingleComponentFactory or + ::com::sun::star::lang::XSingleComponentFactory) +*/ +::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > +SAL_CALL loadSharedLibComponentFactory( + ::rtl::OUString const & rLibName, ::rtl::OUString const & rPath, + ::rtl::OUString const & rImplName, + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > const & xMgr, + ::com::sun::star::uno::Reference< ::com::sun::star::registry::XRegistryKey > const & xKey, + ::rtl::OUString const & rPrefix ) + SAL_THROW( (::com::sun::star::loader::CannotActivateFactoryException) ); + /** Invokes component_writeInfo() function of specified component library. You can give either a fully qualified libname or single lib name. The libname need not be pre/postfixed (e.g. xxx.dll). You can give parameter rPath to force lookup of the library in a specific diff --git a/cppuhelper/prj/build.lst b/cppuhelper/prj/build.lst index 4ff92edfa..570a34560 100644 --- a/cppuhelper/prj/build.lst +++ b/cppuhelper/prj/build.lst @@ -1,4 +1,4 @@ -ch cppuhelper : BOOST:boost LIBXSLT:libxslt codemaker cppu offuh NULL +ch cppuhelper : BOOST:boost LIBXSLT:libxslt DESKTOP:codemaker cppu offapi NULL ch cppuhelper usr1 - all ch_mkout NULL ch cppuhelper\inc nmake - all ch_include NULL ch cppuhelper\source nmake - all ch_source ch_unotypes ch_include NULL diff --git a/cppuhelper/qa/propertysetmixin/comp_propertysetmixin.cxx b/cppuhelper/qa/propertysetmixin/comp_propertysetmixin.cxx index c1f3af984..9f72fb181 100644 --- a/cppuhelper/qa/propertysetmixin/comp_propertysetmixin.cxx +++ b/cppuhelper/qa/propertysetmixin/comp_propertysetmixin.cxx @@ -411,23 +411,16 @@ css::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames() { cppu::ImplementationEntry entries[] = { { &create, &getImplementationName, &getSupportedServiceNames, - &cppu::createSingleComponentFactory, 0, 0 }, + &cppu::createSingleComponentFactory, 0, 0 }, { 0, 0, 0, 0, 0, 0 } }; } -extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory( +extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL mixin_component_getFactory( char const * implName, void * serviceManager, void * registryKey) { return cppu::component_getFactoryHelper( implName, serviceManager, registryKey, entries); } -extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment( - char const ** envTypeName, uno_Environment **) -{ - *envTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; -} - - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cppuhelper/qa/propertysetmixin/makefile.mk b/cppuhelper/qa/propertysetmixin/makefile.mk index be4cfc380..384e2b047 100644 --- a/cppuhelper/qa/propertysetmixin/makefile.mk +++ b/cppuhelper/qa/propertysetmixin/makefile.mk @@ -66,7 +66,6 @@ DEF1NAME = $(SHL1TARGET) SHL2TARGET = $(TARGET).uno SHL2OBJS = $(SLO)/comp_propertysetmixin.obj -SHL2VERSIONMAP = $(SOLARENV)/src/component.map SHL2STDLIBS = $(CPPULIB) $(CPPUHELPERLIB) $(SALLIB) SHL2IMPLIB = i$(SHL2TARGET) SH21RPATH = NONE diff --git a/cppuhelper/qa/propertysetmixin/qa_propertysetmixin.cpp.component b/cppuhelper/qa/propertysetmixin/qa_propertysetmixin.cpp.component index a654e0758..1ae646e98 100644 --- a/cppuhelper/qa/propertysetmixin/qa_propertysetmixin.cpp.component +++ b/cppuhelper/qa/propertysetmixin/qa_propertysetmixin.cpp.component @@ -26,7 +26,7 @@ * **********************************************************************--> -<component loader="com.sun.star.loader.SharedLibrary" +<component loader="com.sun.star.loader.SharedLibrary" prefix="mixin" xmlns="http://openoffice.org/2010/uno-components"> <implementation name="test.cppuhelper.propertysetmixin.comp.CppSupplier"> <service name="test.cppuhelper.propertysetmixin.CppSupplier"/> diff --git a/cppuhelper/source/factory.cxx b/cppuhelper/source/factory.cxx index 63d22c877..f86fd3263 100644 --- a/cppuhelper/source/factory.cxx +++ b/cppuhelper/source/factory.cxx @@ -31,9 +31,11 @@ #include <osl/diagnose.h> #include <osl/mutex.hxx> #include <cppuhelper/weak.hxx> +#include <cppuhelper/bootstrap.hxx> #include <cppuhelper/component.hxx> #include <cppuhelper/factory.hxx> #include <cppuhelper/implbase3.hxx> +#include <cppuhelper/shlib.hxx> #include <cppuhelper/typeprovider.hxx> #include <rtl/instance.hxx> #include <rtl/unload.h> @@ -832,6 +834,7 @@ Reference< XInterface > ORegistryFactoryHelper::createModuleFactory() OUString aActivatorUrl; OUString aActivatorName; OUString aLocation; + OUString aPrefix; Reference<XRegistryKey > xActivatorKey = xImplementationKey->openKey( OUString( RTL_CONSTASCII_USTRINGPARAM("/UNO/ACTIVATOR") ) ); @@ -847,6 +850,15 @@ Reference< XInterface > ORegistryFactoryHelper::createModuleFactory() OUString( RTL_CONSTASCII_USTRINGPARAM("/UNO/LOCATION") ) ); if( xLocationKey.is() && xLocationKey->getValueType() == RegistryValueType_ASCII ) aLocation = xLocationKey->getAsciiValue(); + + Reference<XRegistryKey > xPrefixKey = xImplementationKey->openKey( + OUString( RTL_CONSTASCII_USTRINGPARAM("/UNO/PREFIX") ) ); + if( xPrefixKey.is() && xPrefixKey->getValueType() == RegistryValueType_ASCII ) + { + aPrefix = xPrefixKey->getAsciiValue(); + if( aPrefix.getLength() != 0 ) + aPrefix = aPrefix + OUSTR("_"); + } } else { @@ -881,6 +893,17 @@ Reference< XInterface > ORegistryFactoryHelper::createModuleFactory() Reference<XInterface > x = xSMgr->createInstance( aActivatorName ); Reference<XImplementationLoader > xLoader( x, UNO_QUERY ); Reference<XInterface > xMF; + if( aActivatorName == OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.loader.SharedLibrary") ) ) + { + try + { + return loadSharedLibComponentFactory( bootstrap_expandUri( aLocation ), OUString(), aImplementationName, xSMgr, xImplementationKey, aPrefix ); + } + catch ( IllegalArgumentException & e ) + { + throw RuntimeException( e.Message, e.Context ); + } + } if (xLoader.is()) { xFactory = xLoader->activate( aImplementationName, aActivatorUrl, aLocation, xImplementationKey ); diff --git a/cppuhelper/source/gcc3.map b/cppuhelper/source/gcc3.map index 0aee99691..47983baa3 100644 --- a/cppuhelper/source/gcc3.map +++ b/cppuhelper/source/gcc3.map @@ -158,6 +158,7 @@ _ZN4cppu28createSingleComponentFactoryEPFN3com3sun4star3uno9ReferenceINS3_10XInt _ZN4cppu29WeakComponentImplHelper_queryERKN3com3sun4star3uno4TypeEPNS_10class_dataEPvPNS_27WeakComponentImplHelperBaseE; _ZN4cppu29installTypeDescriptionManagerERKN3com3sun4star3uno9ReferenceINS2_9container23XHierarchicalNameAccessEEE; _ZN4cppu29loadSharedLibComponentFactoryERKN3rtl8OUStringES3_S3_RKN3com3sun4star3uno9ReferenceINS6_4lang20XMultiServiceFactoryEEERKNS8_INS6_8registry12XRegistryKeyEEE; +_ZN4cppu29loadSharedLibComponentFactoryERKN3rtl8OUStringES3_S3_RKN3com3sun4star3uno9ReferenceINS6_4lang20XMultiServiceFactoryEEERKNS8_INS6_8registry12XRegistryKeyEEES3_; _ZN4cppu30ImplHelper_getImplementationIdEPNS_10class_dataE; _ZN4cppu30WeakAggComponentImplHelperBase14queryInterfaceERKN3com3sun4star3uno4TypeE; _ZN4cppu30WeakAggComponentImplHelperBase16addEventListenerERKN3com3sun4star3uno9ReferenceINS3_4lang14XEventListenerEEE; diff --git a/cppuhelper/source/gcc3os2.map b/cppuhelper/source/gcc3os2.map index 2c3bd2d64..dba4c89a3 100644 --- a/cppuhelper/source/gcc3os2.map +++ b/cppuhelper/source/gcc3os2.map @@ -158,6 +158,7 @@ _ZN4cppu28createSingleComponentFactoryEPFN3com3sun4star3uno9ReferenceINS3_10XInt _ZN4cppu29WeakComponentImplHelper_queryERKN3com3sun4star3uno4TypeEPNS_10class_dataEPvPNS_27WeakComponentImplHelperBaseE; _ZN4cppu29installTypeDescriptionManagerERKN3com3sun4star3uno9ReferenceINS2_9container23XHierarchicalNameAccessEEE; _ZN4cppu29loadSharedLibComponentFactoryERKN3rtl8OUStringES3_S3_RKN3com3sun4star3uno9ReferenceINS6_4lang20XMultiServiceFactoryEEERKNS8_INS6_8registry12XRegistryKeyEEE; +_ZN4cppu29loadSharedLibComponentFactoryERKN3rtl8OUStringES3_S3_RKN3com3sun4star3uno9ReferenceINS6_4lang20XMultiServiceFactoryEEERKNS8_INS6_8registry12XRegistryKeyEEES3_; _ZN4cppu30ImplHelper_getImplementationIdEPNS_10class_dataE; _ZN4cppu30WeakAggComponentImplHelperBase14queryInterfaceERKN3com3sun4star3uno4TypeE; _ZN4cppu30WeakAggComponentImplHelperBase16addEventListenerERKN3com3sun4star3uno9ReferenceINS3_4lang14XEventListenerEEE; diff --git a/cppuhelper/source/makefile.mk b/cppuhelper/source/makefile.mk index a7fd22413..f10548282 100755 --- a/cppuhelper/source/makefile.mk +++ b/cppuhelper/source/makefile.mk @@ -162,7 +162,11 @@ SHL1STDLIBS += $(ADVAPI32LIB) .ENDIF SHL1DEPN= +.IF "$(COM)" == "MSC" SHL1IMPLIB=i$(TARGET) +.ELSE +SHL1IMPLIB=uno_$(TARGET)$(COMID) +.ENDIF SHL1OBJS = $(SLOFILES) SHL1RPATH=URELIB diff --git a/cppuhelper/source/msvc_win32_intel.map b/cppuhelper/source/msvc_win32_intel.map index 7069276e2..fef204f36 100644 --- a/cppuhelper/source/msvc_win32_intel.map +++ b/cppuhelper/source/msvc_win32_intel.map @@ -125,6 +125,7 @@ GetVersionInfo; ??0OWeakObject@cppu@@QAE@XZ; ?installTypeDescriptionManager@cppu@@YAEABV?$Reference@VXHierarchicalNameAccess@container@star@sun@com@@@uno@star@sun@com@@@Z; ?loadSharedLibComponentFactory@cppu@@YA?AV?$Reference@VXInterface@uno@star@sun@com@@@uno@star@sun@com@@ABVOUString@rtl@@00ABV?$Reference@VXMultiServiceFactory@lang@star@sun@com@@@3456@ABV?$Reference@VXRegistryKey@registry@star@sun@com@@@3456@@Z; +?loadSharedLibComponentFactory@cppu@@YA?AV?$Reference@VXInterface@uno@star@sun@com@@@uno@star@sun@com@@ABVOUString@rtl@@00ABV?$Reference@VXMultiServiceFactory@lang@star@sun@com@@@3456@ABV?$Reference@VXRegistryKey@registry@star@sun@com@@@3456@0@Z; ?createComponentContext@cppu@@YA?AV?$Reference@VXComponentContext@uno@star@sun@com@@@uno@star@sun@com@@PBUContextEntry_Init@1@JABV23456@@Z; ?bootstrap_InitialComponentContext@cppu@@YA?AV?$Reference@VXComponentContext@uno@star@sun@com@@@uno@star@sun@com@@ABV?$Reference@VXSimpleRegistry@registry@star@sun@com@@@3456@ABVOUString@rtl@@@Z; ?createNestedRegistry@cppu@@YA?AV?$Reference@VXSimpleRegistry@registry@star@sun@com@@@uno@star@sun@com@@ABVOUString@rtl@@@Z; diff --git a/cppuhelper/source/shlib.cxx b/cppuhelper/source/shlib.cxx index 358aac184..a97945431 100644 --- a/cppuhelper/source/shlib.cxx +++ b/cppuhelper/source/shlib.cxx @@ -270,18 +270,16 @@ static OUString makeComponentPath( } //============================================================================== -static OUString getLibEnv(OUString const & aModulePath, - oslModule lib, - uno::Environment * pEnv, +static OUString getLibEnv(oslModule lib, + uno::Environment * pEnv, OUString * pSourceEnv_name, uno::Environment const & cTargetEnv, - OUString const & cImplName = OUString()) + OUString const & cImplName = OUString(), + OUString const & rPrefix = OUString()) { - OUString aExcMsg; - sal_Char const * pEnvTypeName = NULL; - OUString aGetEnvNameExt = OUSTR(COMPONENT_GETENVEXT); + OUString aGetEnvNameExt = rPrefix + OUSTR(COMPONENT_GETENVEXT); component_getImplementationEnvironmentExtFunc pGetImplEnvExt = (component_getImplementationEnvironmentExtFunc)osl_getFunctionSymbol(lib, aGetEnvNameExt.pData); @@ -292,22 +290,17 @@ static OUString getLibEnv(OUString const & aModulePath, } else { - OUString aGetEnvName = OUSTR(COMPONENT_GETENV); + OUString aGetEnvName = rPrefix + OUSTR(COMPONENT_GETENV); component_getImplementationEnvironmentFunc pGetImplEnv = (component_getImplementationEnvironmentFunc)osl_getFunctionSymbol( lib, aGetEnvName.pData ); if (pGetImplEnv) pGetImplEnv(&pEnvTypeName, (uno_Environment **)pEnv); - else - { - aExcMsg = aModulePath; - aExcMsg += OUSTR(": cannot get symbol: "); - aExcMsg += aGetEnvName; - aExcMsg += OUSTR("- nor: "); - } + else // this symbol used to be mandatory, but is no longer + pEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } - + if (!pEnv->is() && pEnvTypeName) { *pSourceEnv_name = OUString::createFromAscii(pEnvTypeName); @@ -325,12 +318,10 @@ static OUString getLibEnv(OUString const & aModulePath, *pSourceEnv_name += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(":log")); break; } - } while( nIndex != -1 ); + } while( nIndex != -1 ); } - } - - return aExcMsg; + return OUString(); } extern "C" {static void s_getFactory(va_list * pParam) @@ -344,6 +335,7 @@ extern "C" {static void s_getFactory(va_list * pParam) *ppSSF = pSym(pImplName->getStr(), pSMgr, pKey); }} +/* For backwards compatibility */ Reference< XInterface > SAL_CALL loadSharedLibComponentFactory( OUString const & rLibName, OUString const & rPath, OUString const & rImplName, @@ -351,6 +343,17 @@ Reference< XInterface > SAL_CALL loadSharedLibComponentFactory( Reference< registry::XRegistryKey > const & xKey ) SAL_THROW( (loader::CannotActivateFactoryException) ) { + return loadSharedLibComponentFactory( rLibName, rPath, rImplName, xMgr, xKey, rtl::OUString() ); +} + +Reference< XInterface > SAL_CALL loadSharedLibComponentFactory( + OUString const & rLibName, OUString const & rPath, + OUString const & rImplName, + Reference< lang::XMultiServiceFactory > const & xMgr, + Reference< registry::XRegistryKey > const & xKey, + OUString const & rPrefix ) + SAL_THROW( (loader::CannotActivateFactoryException) ) +{ OUString aModulePath( makeComponentPath( rLibName, rPath ) ); if (! checkAccessPath( &aModulePath )) { @@ -376,10 +379,10 @@ Reference< XInterface > SAL_CALL loadSharedLibComponentFactory( OUString aEnvTypeName; - OUString aExcMsg = getLibEnv(aModulePath, lib, &env, &aEnvTypeName, currentEnv, rImplName); + OUString aExcMsg = getLibEnv(lib, &env, &aEnvTypeName, currentEnv, rImplName, rPrefix); if (!aExcMsg.getLength()) { - OUString aGetFactoryName = OUSTR(COMPONENT_GETFACTORY); + OUString aGetFactoryName = rPrefix + OUSTR(COMPONENT_GETFACTORY); oslGenericFunction pSym = osl_getFunctionSymbol( lib, aGetFactoryName.pData ); if (pSym != 0) { @@ -522,7 +525,7 @@ void SAL_CALL writeSharedLibComponentInfo( uno::Environment env; OUString aEnvTypeName; - OUString aExcMsg = getLibEnv(aModulePath, lib, &env, &aEnvTypeName, currentEnv); + OUString aExcMsg = getLibEnv(lib, &env, &aEnvTypeName, currentEnv); if (!aExcMsg.getLength()) { OUString aWriteInfoName = OUSTR(COMPONENT_WRITEINFO); diff --git a/cppuhelper/test/cfg_test.cxx b/cppuhelper/test/cfg_test.cxx index 3779fb72d..735f7eefe 100644 --- a/cppuhelper/test/cfg_test.cxx +++ b/cppuhelper/test/cfg_test.cxx @@ -227,12 +227,6 @@ static struct ImplementationEntry g_entries[] = extern "C" { //================================================================================================== -SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment( - const sal_Char ** ppEnvTypeName, uno_Environment ** /*ppEnv*/ ) -{ - *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; -} -//================================================================================================== sal_Bool SAL_CALL component_writeInfo( void * pServiceManager, void * pRegistryKey ) { |