[ooo-build-commit] .: 2 commits - patches/dev300 patches/mono

Noel Power noelp at kemper.freedesktop.org
Tue Sep 28 08:44:25 PDT 2010


 patches/dev300/apply                     |   14 
 patches/dev300/cli-component.diff        | 1062 +++++++++++++++++++++++++++++++
 patches/dev300/cli-mono-common.diff      |  504 ++++++++++++++
 patches/mono/cli_ure-mono-bridge.diff    |    2 
 patches/mono/cli_ure-prj-build-lst.diff  |    4 
 patches/mono/mono-build-keyfile.diff     |    2 
 patches/mono/mono-build.diff             |    4 
 patches/mono/mono-component-support.diff |  578 ++++++++++++++++
 8 files changed, 2162 insertions(+), 8 deletions(-)

New commits:
commit a492b6602834966119bd8a566718eeb779bd2eb8
Author: Noel Power <noel.power at novell.com>
Date:   Tue Sep 28 14:57:11 2010 +0100

    tweak file/url handling

diff --git a/patches/mono/mono-component-support.diff b/patches/mono/mono-component-support.diff
index 04a33d3..8b14e3d 100644
--- a/patches/mono/mono-component-support.diff
+++ b/patches/mono/mono-component-support.diff
@@ -70,38 +70,7 @@ new file mode 100644
 index 0000000..6fadcd2
 --- /dev/null
 +++ cli_ure/source/mono_loader/makefile.mk
-@@ -0,0 +1,78 @@
-+#*************************************************************************
-+#
-+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+# 
-+# Copyright 2008 by Sun Microsystems, Inc.
-+#
-+# OpenOffice.org - a multi-platform office productivity suite
-+#
-+# $RCSfile: makefile.mk,v $
-+#
-+# $Revision: 1.0 $
-+#
-+# This file is part of OpenOffice.org.
-+#
-+# OpenOffice.org is free software: you can redistribute it and/or modify
-+# it under the terms of the GNU Lesser General Public License version 3
-+# only, as published by the Free Software Foundation.
-+#
-+# OpenOffice.org is distributed in the hope that it will be useful,
-+# but WITHOUT ANY WARRANTY; without even the implied warranty of
-+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-+# GNU Lesser General Public License version 3 for more details
-+# (a copy is included in the LICENSE file that accompanied this code).
-+#
-+# You should have received a copy of the GNU Lesser General Public License
-+# version 3 along with OpenOffice.org.  If not, see
-+# <http://www.openoffice.org/license.html>
-+# for a copy of the LGPLv3 License.
-+#
-+#*************************************************************************
-+
+@@ -0,0 +1,47 @@
 +PRJ=..$/..
 +
 +PRJNAME=cli_ure
@@ -154,37 +123,7 @@ new file mode 100644
 index 0000000..ed090cb
 --- /dev/null
 +++ cli_ure/source/mono_loader/mono_loader.cxx
-@@ -0,0 +1,255 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ * 
-+ * Copyright 2008 by Sun Microsystems, Inc.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: eventhelper.cxx,v $
-+ * $Revision: 1.0 $
-+ *
-+ * This file is part of OpenOffice.org.
-+ *
-+ * OpenOffice.org is free software: you can redistribute it and/or modify
-+ * it under the terms of the GNU Lesser General Public License version 3
-+ * only, as published by the Free Software Foundation.
-+ *
-+ * OpenOffice.org is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-+ * GNU Lesser General Public License version 3 for more details
-+ * (a copy is included in the LICENSE file that accompanied this code).
-+ *
-+ * You should have received a copy of the GNU Lesser General Public License
-+ * version 3 along with OpenOffice.org.  If not, see
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+
+@@ -0,0 +1,237 @@
 +// MARKER(update_precomp.py): autogen include statement, do not remove
 +#include "precompiled_cli_ure.hxx"
 +#include <comphelper/processfactory.hxx>
@@ -198,6 +137,7 @@ index 0000000..ed090cb
 +#include <com/sun/star/util/XMacroExpander.hpp>
 +#include <cppuhelper/implbase2.hxx>
 +#include "uno/mapping.hxx"
++#include "osl/file.hxx"
 +
 +// for debug
 +#include <comphelper/anytostring.hxx>
@@ -311,7 +251,18 @@ index 0000000..ed090cb
 +        {
 +            throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "component context fails to supply singleton" " com.sun.star.util.theMacroExpander of type" " com.sun.star.util.XMacroExpander")), mxContext);        
 +        }
-+        rtl::OUString dllPath =  mxExpander->expandMacros( rtl::OUString(  RTL_CONSTASCII_USTRINGPARAM( CLIURE_DLL ) ) );
++
++        rtl::OUString dllUrlPath =  mxExpander->expandMacros( rtl::OUString(  RTL_CONSTASCII_USTRINGPARAM( CLIURE_DLL ) ) );
++        rtl::OUString dllPath;
++        if ( osl::FileBase::E_None != osl::FileBase::getSystemPathFromFileURL(
++                dllUrlPath, dllPath ))
++        {
++            throw uno::RuntimeException(
++                OUSTR("cannot get system path from file url ") +
++                dllPath,
++                uno::Reference< uno::XInterface >() );
++        }
++         
 +        OSL_TRACE("**** location for dll is %s", rtl::OUStringToOString( dllPath, RTL_TEXTENCODING_UTF8 ).getStr() );
 +        OSL_TRACE("** MonoLoader::MonoLoader() ");
 +        mxLoader = getLoader( rtl::OUStringToOString( dllPath, RTL_TEXTENCODING_UTF8 ).getStr() );
commit 7ff57ae72c26768d09a3928bf51c21a647557633
Author: Noel Power <noel.power at novell.com>
Date:   Tue Sep 28 14:42:13 2010 +0100

    add experimental csharp/mono component support

diff --git a/patches/dev300/apply b/patches/dev300/apply
index ba4ae35..10e4941 100644
--- a/patches/dev300/apply
+++ b/patches/dev300/apply
@@ -22,10 +22,10 @@ Common : BuildBits, TemporaryHacks, FixesNotForUpstream, \
 
 LinuxCommon : Common, Defaults, FontConfigTemporaryHacks, \
 	      FedoraLinuxOnlyFixes, LinuxOnly, msaccess, OpenGLTransitions, \
-	      Mono, AddressBooks, QuickStarter, KDE4, Netbook, \
+	      CliMonoCommon, Mono, MonoComp, AddressBooks, QuickStarter, KDE4, Netbook, \
 	      GlobalNSPluginSupport, SystemBitsWithSTLport
 MacOSXCommon : Common, Defaults
-Win32Common : Common, Defaults, Win32Only, NotDebian
+Win32Common : Common, Defaults, Win32Only, CliMonoCommon, CliComponent, NotDebian
 # Experimental sections
 Experimental: VBAUntested, ArkOnlyExperimental, \
 	      UnUsedButNotYetRemovedFromGit, WebDAVUpstream, \
@@ -163,6 +163,12 @@ helpcontent-scalc-01.diff, kohei
 [ LocalizeFixes ]
 # FIXME dev300-m77 helpcontent-scalc-01-localize.diff, kohei
 
+[ CliMonoCommon ]
+cli-mono-common.diff
+
+[ CliComponent ]
+cli-component.diff
+
 [ CWSBackports ]
 # koheichart02 cws (supported mixed chart types in single diagram).
 cws-koheichart02-chart2.diff, kohei
@@ -1105,6 +1111,10 @@ cli_ure-prj-build-lst.diff
 mono-climaker-config.diff
 
 mono-climaker-bridgetest.diff
+# Mono component support of course requires Mono
+# same caveat applied too e.g. experimental
+[ MonoComp ]
+mono-component-support.diff
 
 [ VBAObjects ]
 SectionOwner => noelpwer
diff --git a/patches/dev300/cli-component.diff b/patches/dev300/cli-component.diff
new file mode 100644
index 0000000..f42ce64
--- /dev/null
+++ b/patches/dev300/cli-component.diff
@@ -0,0 +1,1062 @@
+diff --git cli_ure/prj/build.lst cli_ure/prj/build.lst
+index 268240c..c5aac81 100644
+--- cli_ure/prj/build.lst
++++ cli_ure/prj/build.lst
+@@ -6,7 +6,9 @@ ure	cli_ure\source				nmake   -   w,vc7   ure_source_source ure_inc NULL
+ ure	cli_ure\source\climaker		nmake	-	w,vc7	ure_source_climaker ure_source_basetypes.w ure_inc NULL
+ ure	cli_ure\unotypes			nmake	-	w,vc7	ure_unotypes ure_source_version ure_source_source.w ure_source_climaker.w ure_inc NULL
+ ure	cli_ure\source\ure			nmake	-	w,vc7	ure_source_ure ure_source_version ure_source_source.w ure_source_basetypes.w ure_unotypes.w ure_inc NULL
+-ure	cli_ure\source\uno_bridge	nmake	-	w,vc7	ure_source_uno_bridge ure_source_basetypes.w ure_unotypes.w ure_source_ure.w ure_inc NULL
++ure	cli_ure\source\cli_callback			nmake   -   w,vc7   ure_source_cli_callback ure_inc NULL
++ure	cli_ure\source\uno_bridge	nmake	-	w,vc7	ure_source_uno_bridge ure_source_cli_callback.w ure_source_basetypes.w ure_unotypes.w ure_source_ure.w ure_inc NULL
++ure	cli_ure\source\cli_loader	nmake	-	all	ure_source_uno_loader ure_source_uno_bridge.w ure_source_basetypes.w ure_unotypes.w ure_source_ure.w ure_inc NULL
+ ure	cli_ure\source\native		nmake	-	w,vc7	ure_source_native ure_source_version ure_source_source.w ure_source_ure.w ure_unotypes.w ure_source_uno_bridge.w ure_inc NULL
+ 
+ #ure	cli_ure\util			nmake	-	w,vc7	ure_util ure_source_ure.w ure_source_native.w NULL
+diff --git cli_ure/source/cli_callback/cli_callback.cxx cli_ure/source/cli_callback/cli_callback.cxx
+new file mode 100644
+index 0000000..ef6129e
+--- /dev/null
++++ cli_ure/source/cli_callback/cli_callback.cxx
+@@ -0,0 +1,163 @@
++#include "cli_callback.hxx"
++#include "uno/environment.h"
++#include "osl/diagnose.h"
++
++// The redirectedxxxfunc functions below are to be used with the Managed 
++// cli bridge. Native code communicating with the cli bridge we cannot control 
++// when the shutdown of the clr runtime occurs, communicating with 
++// managed code in the (mixed) bridge dll after or during the clr shutdown
++// results in unexpected results,  unhandled exceptions & unexpected exits.
++// The cli bridge inserts the proxyfree, proxyquire, proxyrelease, proxydispatch
++// as the uno_Interface handlers, proxyfree & friends call the equivelant
++// redirectedfreefunc & friends handlers.
++// So... while normal processing occurs the calling sequence is
++// uno_Interface.free -> proxyfree -> redirectfreefunc -> cli_proxy_free
++// when the cli bridge dll is about to exit ( but before shutting down the clr )
++// redirectedfreefunc & friends are set to harmless noop functions e.g.
++// uno_Interface.free -> proxyfree -> redirectfreefunc -> noopfree
++// This ensure that any calls from a bridge proxy object are harmlessly
++// ignored during or after the bridge libraries shutdown & detatch
++// #FIXME idealy  Cli_proxy ( see cli_proxy.cxx & cli_proxy.h ) itself should be
++// modified to be a listener for a shutdown starting message and should
++// replaces it's own handlers. However the equivelant noop functions still will
++// need to exist in real native a ( not mixed ) dll ( or at least thats my
++// experience sofar ). At the same time not sure if there is a better solution
++// and this rather heavy handed approach I think will work as well ( with little
++// effort for the moment.
++
++freefunc redirectedfreefunc = NULL;
++acquirefunc redirectedacquirefunc = NULL;
++releasefunc redirectedreleasefunc = NULL;
++dispatchfunc redirecteddispatchfunc = NULL;
++
++extern "C"
++void SAL_CALL noopfree( uno_ExtEnvironment * env, void * proxy ) SAL_THROW_EXTERN_C()
++{
++    OSL_TRACE("noopfree"); 
++}
++
++extern "C"
++void SAL_CALL noopacquire( uno_Interface * pUnoI ) SAL_THROW_EXTERN_C()
++{
++    OSL_TRACE("noopacquire");
++}
++
++extern "C"
++void SAL_CALL nooprelease( uno_Interface * pUnoI ) SAL_THROW_EXTERN_C()
++{
++    OSL_TRACE("nooprelease");
++}
++extern "C"
++void SAL_CALL noopdispatch(
++    uno_Interface * pUnoI, typelib_TypeDescription const * member_td,
++    void * uno_ret, void * uno_args [], uno_Any ** uno_exc ) SAL_THROW_EXTERN_C()
++{
++    OSL_TRACE("noopdispatch");
++}
++
++
++extern "C"
++void SAL_CALL proxyfree( uno_ExtEnvironment * env, void * proxy ) SAL_THROW_EXTERN_C()
++{
++    OSL_TRACE("proxyfree"); 
++    redirectedfreefunc( env, proxy );
++}
++
++extern "C"
++void SAL_CALL proxyacquire( uno_Interface * pUnoI ) SAL_THROW_EXTERN_C()
++{
++    OSL_TRACE("proxyacquire");
++    redirectedacquirefunc( pUnoI );
++}
++
++extern "C"
++void SAL_CALL proxyrelease( uno_Interface * pUnoI ) SAL_THROW_EXTERN_C()
++{
++    OSL_TRACE("proxyrelease");
++    redirectedreleasefunc( pUnoI );
++}
++extern "C"
++void SAL_CALL proxydispatch(
++    uno_Interface * pUnoI, typelib_TypeDescription const * member_td,
++    void * uno_ret, void * uno_args [], uno_Any ** uno_exc ) SAL_THROW_EXTERN_C()
++{
++    OSL_TRACE("proxydispatch");
++    redirecteddispatchfunc( pUnoI, member_td, uno_ret, uno_args, uno_exc );
++}
++
++CallBackHandler::CallBackHandler() 
++{
++    OSL_TRACE("CallBackHandler");
++    resetHandlers(); // initialiase handler to noops
++}
++
++CallBackHandler::~CallBackHandler() 
++{
++    OSL_TRACE("~CallBackHandler");
++}
++
++void 
++CallBackHandler::resetHandlers()
++{
++    OSL_TRACE("CallBackHandler::resetHandlers");
++
++    redirectedfreefunc = noopfree;
++    redirectedacquirefunc = noopacquire;
++    redirectedreleasefunc = nooprelease;
++    redirecteddispatchfunc = noopdispatch;
++}
++
++
++CallBackHandler&
++CallBackHandler::instance()
++{
++    static CallBackHandler inst;
++    return inst;
++}
++
++void CallBackHandler::setAcquireHandler( acquirefunc pFunc )
++{
++    OSL_TRACE("setAcquireHandler");
++    redirectedacquirefunc = pFunc;
++}
++
++void CallBackHandler::setReleaseHandler( releasefunc pFunc )
++{
++    OSL_TRACE("setReleaseHandler");
++    redirectedreleasefunc = pFunc;
++}
++
++void CallBackHandler::setDispatchHandler( dispatchfunc pFunc )
++{
++    OSL_TRACE("setDispatchHandler");
++    redirecteddispatchfunc = pFunc;
++}
++
++void CallBackHandler::setFreeHandler( freefunc pFunc )
++{
++    redirectedfreefunc = pFunc;
++}
++
++acquirefunc
++CallBackHandler::getAcquireHandler()
++{
++    return proxyacquire;
++}
++
++releasefunc
++CallBackHandler::getReleaseHandler()
++{
++    return proxyrelease;
++}
++
++dispatchfunc
++CallBackHandler::getDispatchHandler()
++{
++    return proxydispatch;
++}
++
++freefunc
++CallBackHandler::getFreeHandler()
++{
++    return proxyfree;
++}
+diff --git cli_ure/source/cli_callback/makefile.mk cli_ure/source/cli_callback/makefile.mk
+new file mode 100644
+index 0000000..cdeafac
+--- /dev/null
++++ cli_ure/source/cli_callback/makefile.mk
+@@ -0,0 +1,48 @@
++PRJ=..$/..
++PRJNAME=cli_ure
++
++TARGET=cli_callback
++
++VISIBILITY_HIDDEN=TRUE
++NO_BSYMBOLIC=	TRUE
++ENABLE_EXCEPTIONS=TRUE
++USE_DEFFILE = TRUE
++
++# --- Settings -----------------------------------------------------
++
++.INCLUDE :  settings.mk
++DLLPRE =
++
++SHL1TARGET= $(TARGET)$(DLLPOSTFIX)
++
++# ------------------------------------------------------------------
++
++
++SLOFILES= \
++		$(SLO)$/cli_callback.obj
++
++
++SHL1OBJS = $(SLOFILES)
++SHL1DEPN=
++SHL1IMPLIB=i$(TARGET)
++SHL1DEF=$(MISC)$/$(SHL1TARGET).def
++DEF1NAME=$(SHL1TARGET)
++#SHL1USE_EXPORTS=name
++SHL1VERSIONMAP = msvc.map
++
++SHL1DEF = $(MISC)$/$(SHL1TARGET).def
++DEF1NAME = $(SHL1TARGET)
++
++SHL1STDLIBS= \
++                $(CPPUHELPERLIB) \
++		$(COMPHELPERLIB) \
++                $(CPPULIB) \
++                $(TOOLSLIB) \
++                $(SALLIB)
++
++                                                                              
++SHL1LIBS=$(SLB)$/$(TARGET).lib
++
++# --- Targets ------------------------------------------------------
++
++.INCLUDE :	target.mk
+diff --git cli_ure/source/cli_callback/msvc.map cli_ure/source/cli_callback/msvc.map
+new file mode 100644
+index 0000000..429f750
+--- /dev/null
++++ cli_ure/source/cli_callback/msvc.map
+@@ -0,0 +1,6 @@
++UDK_3_0_0 {
++    global:
++
++    local:
++    *;
++};
+diff --git cli_ure/source/inc/cli_callback.hxx cli_ure/source/inc/cli_callback.hxx
+new file mode 100644
+index 0000000..dea95d1
+--- /dev/null
++++ cli_ure/source/inc/cli_callback.hxx
+@@ -0,0 +1,36 @@
++#ifndef _UNO_DUMMY_H_
++#define _UNO_DUMMY_H_
++
++#include "uno/dispatcher.h"
++#include "typelib/typedescription.h"
++#include "uno/any2.h"
++#include "uno/environment.h"
++
++
++typedef void (SAL_CALL * freefunc)( uno_ExtEnvironment * env, void * proxy ) SAL_THROW_EXTERN_C();
++typedef void (SAL_CALL * acquirefunc)( uno_Interface * pInterface ) SAL_THROW_EXTERN_C();
++typedef void (SAL_CALL * releasefunc)( uno_Interface * pInterface ) SAL_THROW_EXTERN_C();
++typedef void (SAL_CALL * dispatchfunc)( uno_Interface * pUnoI, typelib_TypeDescription const * member_td, void * uno_ret, void * uno_args [], uno_Any ** uno_exc ) SAL_THROW_EXTERN_C();
++
++
++class __declspec(dllexport) CallBackHandler
++{
++public:
++    static CallBackHandler& instance();
++    void resetHandlers();
++    void setAcquireHandler( acquirefunc pFunc );
++    void setReleaseHandler( releasefunc pFunc );
++    void setDispatchHandler( dispatchfunc pFunc );
++    void setFreeHandler( freefunc pFunc );
++
++   acquirefunc getAcquireHandler();
++   releasefunc getReleaseHandler();
++   dispatchfunc getDispatchHandler();
++   freefunc getFreeHandler();
++private:
++    CallBackHandler();
++    ~CallBackHandler();
++};
++
++#endif
++
+diff --git cli_ure/source/inc/cli_loader_wrapper.h cli_ure/source/inc/cli_loader_wrapper.h
+new file mode 100644
+index 0000000..aa6f177
+--- /dev/null
++++ cli_ure/source/inc/cli_loader_wrapper.h
+@@ -0,0 +1,5 @@
++#ifndef INCLUDED_CLI_WRAPPER_H
++#define INCLUDED_CLI_WRAPPER_H
++// wrapper function to load managed CLI Loader
++    __declspec(dllexport) void* getCLILoader();
++#endif
+diff --git cli_ure/source/uno_bridge/cli_environment.cxx cli_ure/source/uno_bridge/cli_environment.cxx
+index 88ee3cb..713b378 100644
+--- cli_ure/source/uno_bridge/cli_environment.cxx
++++ cli_ure/source/uno_bridge/cli_environment.cxx
+@@ -35,6 +35,8 @@
+ #using <system.dll>
+ #include "osl/diagnose.h"
+ #include "cli_proxy.h"
++#include "cli_callback.hxx"
++#include <stdlib.h>
+ 
+ using namespace System::Runtime::Remoting;
+ using namespace System::Runtime::Remoting::Proxies;
+@@ -51,18 +53,60 @@ inline System::String* Cli_environment::createKey(System::String* oid, System::T
+     return System::String::Concat(oid, t->get_FullName());
+ }
+ 
++int aboutToShutdown(void)
++{
++    OSL_TRACE("about to shutdown");
++    // Clr shutdown is about to happen, we have to ensure that no 
++    // code located in this dll cannot be called from native code
++    // trying to do this in object finalizers etc. is already too late
++    // E.g. a static uno reference ( located in native code ) to an object
++    // object located in this bridge will more than likely when destructing 
++    // call cli_proxy_release while the clr either cleaning up or already 
++    // shutdown ( but before this dll has detatched )
++    // Any call from native code into managed code during or after the clr
++    // shutdown will result in a core ( or undefined behaviour )
++    // Taking this action might result in some resource leakage but
++    // thats unavoidable
++    
++    CallBackHandler::instance().resetHandlers(); 
++    return 0;
++}
++
+ 
+ inline Cli_environment::Cli_environment()
+ {
++    OSL_TRACE("Cli_environment::Cli_environment() !!!");
+ #if OSL_DEBUG_LEVEL >= 2
+     _numRegisteredObjects = 0;
+ #endif    
++    CliProxy::setUpProxyHandlers(); // insert a native code handler ( that will redirect to the managed c++ hanlder, when the clr is about to shutdown we reset the native handlers to be a noop ( but located in a native dll ) so no clr code is called ( which causes crazy exceptions and undefined madness )
++    _onexit_m( aboutToShutdown );
+ }
+ 
+ Cli_environment::~Cli_environment()
+ {
++    OSL_TRACE("Cli_environment::~Cli_environment()");
++    IEnumerator* iEnum = m_objects->Keys->GetEnumerator();
++    while( iEnum->MoveNext() )
++    {
++        System::String* key = static_cast< System::String* >( iEnum->get_Current() );
++        Trace::WriteLine(System::String::Format(
++               new System::String(S"Cli_environment::~Cli_environment() "
++               S"has oid {0} "),
++               key ));
++
++    }
++
+     OSL_ENSURE(_numRegisteredObjects == 0,
+                "cli uno bridge: CLI environment contains unrevoked objects");
++
++#if OSL_DEBUG_LEVEL >= 2
++    if (_numRegisteredObjects != 0 )
++    {
++        OSL_TRACE("<sigh... CLI environment contains unrevoked objects");
++    }
++#endif
++
+ }
+ 
+ 
+diff --git cli_ure/source/uno_bridge/cli_loaderwrapper.cxx cli_ure/source/uno_bridge/cli_loaderwrapper.cxx
+new file mode 100644
+index 0000000..01b0503
+--- /dev/null
++++ cli_ure/source/uno_bridge/cli_loaderwrapper.cxx
+@@ -0,0 +1,64 @@
++// Use UNICODE Windows and C API.
++#define _UNICODE
++#define UNICODE
++
++#ifdef _MSC_VER
++#pragma warning(push, 1)
++#endif
++#include <windows.h>
++#include "uno/environment.hxx"
++#ifdef _MSC_VER
++#pragma warning(pop)
++#endif
++
++#include <tchar.h>
++
++#include "com/sun/star/loader/XImplementationLoader.hpp"
++
++#include "cli_loader_wrapper.h"
++#include "rtl/ustring.hxx"
++#include "uno/mapping.hxx"
++#define OUSTR(x) ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(x) )
++
++#using "cli_ure.dll"
++
++using namespace ::rtl;
++using namespace ::com::sun::star;
++using namespace ::com::sun::star::uno;
++using namespace ::uno::util;
++
++    void* getCLILoader()
++    {
++    ::com::sun::star::uno::Mapping mapping(
++        OUSTR(UNO_LB_CLI), OUSTR(CPPU_CURRENT_LANGUAGE_BINDING_NAME) );
++    OSL_ASSERT( mapping.is() );
++    if (! mapping.is())
++        if (! mapping.is())
++        {
++            throw ::com::sun::star::uno::RuntimeException(
++                OUSTR("cannot get mapping from CLI to C++!"),
++                ::com::sun::star::uno::Reference<
++                  ::com::sun::star::uno::XInterface >() );
++        }
++        System::Object* pObj = new ::uno::util::ManagedCodeLoader();
++        System::Runtime::InteropServices::GCHandle handle(
++            ::System::Runtime::InteropServices::GCHandle::Alloc( pObj ) );
++        typelib_InterfaceTypeDescription* pType_XImplementationLoader = NULL;
++        com::sun::star::loader::XImplementationLoader::static_type().getDescription( (typelib_TypeDescription **) & pType_XImplementationLoader);
++
++
++        void* ret = mapping.mapInterface(
++            reinterpret_cast< void * >(
++                ::System::Runtime::InteropServices::GCHandle::op_Explicit( handle )
++#if defined _WIN32
++                 .ToInt32()
++#elif defined _WIN64
++                 .ToInt64()
++#else
++#error ERROR: either _WIN64 or _WIN32 must be defined
++            ERROR: either _WIN64 or _WIN32 must be defined
++#endif        
++            ), pType_XImplementationLoader );
++        handle.Free();
++        return ret;
++    }
+diff --git cli_ure/source/uno_bridge/cli_proxy.cxx cli_ure/source/uno_bridge/cli_proxy.cxx
+index e5a9b51..6735733 100644
+--- cli_ure/source/uno_bridge/cli_proxy.cxx
++++ cli_ure/source/uno_bridge/cli_proxy.cxx
+@@ -34,6 +34,7 @@
+ #include "cli_proxy.h"
+ #include "cli_base.h"
+ #include "cli_bridge.h"
++#include "cli_callback.hxx"
+ 
+ #using <mscorlib.dll>
+ #using <cli_ure.dll>
+@@ -105,6 +106,7 @@ UnoInterfaceInfo::UnoInterfaceInfo(Bridge const * bridge, uno_Interface* unoI,
+ UnoInterfaceInfo::~UnoInterfaceInfo()
+ {
+     //accessing unmanaged objects is ok.
++   OSL_TRACE("UnoInterfaceInfo::~UnoInterfaceInfo()");
+    m_bridge->m_uno_env->revokeInterface(
+             m_bridge->m_uno_env, m_unoI );
+    m_bridge->release();
+@@ -141,6 +143,7 @@ UnoInterfaceProxy::UnoInterfaceProxy(
+ 
+ UnoInterfaceProxy::~UnoInterfaceProxy()
+ {
++   OSL_TRACE("UnoInterfaceProxy::~UnoInterfaceProxy()" );
+ #if OSL_DEBUG_LEVEL >= 2
+     sd::Trace::WriteLine(System::String::Format(
+                new System::String(S"cli uno bridge: Destroying proxy "
+@@ -422,6 +425,7 @@ srrm::IMessage* UnoInterfaceProxy::Invoke(srrm::IMessage* callmsg)
+ {
+     try
+     {
++        OSL_TRACE("UnoInterfaceProxy::Invoke ");
+         sc::IDictionary* props= callmsg->Properties;
+         srrm::LogicalCallContext* context=
+             static_cast<srrm::LogicalCallContext*>(
+@@ -672,9 +676,9 @@ CliProxy::CliProxy(Bridge const* bridge, System::Object* cliI,
+     m_nInheritedInterfaces(0)
+ {
+     m_bridge->acquire();
+-    uno_Interface::acquire = cli_proxy_acquire;
+-    uno_Interface::release = cli_proxy_release;
+-    uno_Interface::pDispatcher = cli_proxy_dispatch;
++    uno_Interface::acquire = CallBackHandler::instance().getAcquireHandler();//cli_proxy_acquire;
++    uno_Interface::release = CallBackHandler::instance().getReleaseHandler();//cli_proxy_release;
++    uno_Interface::pDispatcher = CallBackHandler::instance().getDispatchHandler();//cli_proxy_dispatch;
+ 
+     m_unoType.makeComplete();
+     m_type= mapUnoType(m_unoType.get());
+@@ -898,7 +902,7 @@ uno_Interface* CliProxy::create(Bridge const * bridge,
+     (*bridge->m_uno_env->registerProxyInterface)(
+        bridge->m_uno_env,
+        reinterpret_cast<void**>(&proxy),
+-       cli_proxy_free,
++       CallBackHandler::instance().getFreeHandler(),//cli_proxy_free,
+        ousOid.pData, (typelib_InterfaceTypeDescription*) pTD);
+     //register original interface
+     CliEnvHolder::g_cli_env->registerInterface(cliI, mapUnoString(ousOid.pData),
+@@ -926,7 +930,8 @@ inline void CliProxy::acquire() const
+         // register at uno env
+         (*m_bridge->m_uno_env->registerProxyInterface)(
+             m_bridge->m_uno_env, &that,
+-            cli_proxy_free, m_usOid.pData,
++            cli_proxy_free, 
++            m_usOid.pData,
+             (typelib_InterfaceTypeDescription *)m_unoType.get() );
+ #if OSL_DEBUG_LEVEL >= 2
+         OSL_ASSERT( this == (void const * const)that );
+@@ -947,6 +952,14 @@ inline void CliProxy::release() const
+             m_bridge->m_uno_env, const_cast< CliProxy * >( this ) );
+     }
+ }
++void CliProxy::setUpProxyHandlers()
++{
++    CallBackHandler& cbHandler = CallBackHandler::instance();
++    cbHandler.setAcquireHandler( cli_proxy_acquire );
++    cbHandler.setReleaseHandler( cli_proxy_release );
++    cbHandler.setDispatchHandler( cli_proxy_dispatch );
++    cbHandler.setFreeHandler( cli_proxy_free );
++}
+ }
+ 
+ 
+@@ -956,6 +969,7 @@ extern "C"
+ void SAL_CALL cli_proxy_free( uno_ExtEnvironment *, void * proxy )
+     SAL_THROW_EXTERN_C()
+ {
++    OSL_TRACE("cli_proxy_free ..");
+     cli_uno::CliProxy * cliProxy = reinterpret_cast<
+         cli_uno::CliProxy * >( proxy );
+ 
+@@ -966,6 +980,7 @@ extern "C"
+ void SAL_CALL cli_proxy_acquire( uno_Interface * pUnoI )
+     SAL_THROW_EXTERN_C()
+ {
++    OSL_TRACE("cli_proxy_acquire ..");
+     CliProxy const * cliProxy = static_cast< CliProxy const * >( pUnoI );
+     cliProxy->acquire();
+ }
+@@ -974,6 +989,7 @@ extern "C"
+ void SAL_CALL cli_proxy_release( uno_Interface * pUnoI )
+     SAL_THROW_EXTERN_C()
+ {
++    OSL_TRACE("cli_proxy_release ..");
+     CliProxy * cliProxy = static_cast< CliProxy * >( pUnoI );
+     cliProxy->release();
+ }
+@@ -986,6 +1002,7 @@ void SAL_CALL cli_proxy_dispatch(
+     void * uno_ret, void * uno_args [], uno_Any ** uno_exc )
+     SAL_THROW_EXTERN_C()
+ {
++    OSL_TRACE("cli_proxy_dispatch B ..");
+     CliProxy * proxy = static_cast< CliProxy* >( pUnoI );
+     try
+     {
+@@ -1171,8 +1188,3 @@ void SAL_CALL cli_proxy_dispatch(
+ #endif
+     }
+ }
+-
+-
+-
+-
+-
+diff --git cli_ure/source/uno_bridge/cli_proxy.h cli_ure/source/uno_bridge/cli_proxy.h
+index 1471ae5..b9eb838 100644
+--- cli_ure/source/uno_bridge/cli_proxy.h
++++ cli_ure/source/uno_bridge/cli_proxy.h
+@@ -178,6 +178,9 @@ protected:
+ //Cannot make this __gc because a managed type cannot derive from unmanaged type
+ struct CliProxy: public uno_Interface
+ {
++
++    static void setUpProxyHandlers();
++
+     mutable oslInterlockedCount m_ref;
+     const Bridge* m_bridge;
+     const gcroot<System::Object*> m_cliI;
+@@ -295,5 +298,6 @@ struct CliProxy: public uno_Interface
+     inline void acquire() const;
+     inline void release() const;
+ };
++
+ }
+ #endif
+diff --git cli_ure/source/uno_bridge/makefile.mk cli_ure/source/uno_bridge/makefile.mk
+index b7682ae..8d4c816 100644
+--- cli_ure/source/uno_bridge/makefile.mk
++++ cli_ure/source/uno_bridge/makefile.mk
+@@ -65,16 +65,18 @@ SLOFILES = \
+     $(SLO)$/cli_bridge.obj		\
+     $(SLO)$/cli_data.obj		\
+     $(SLO)$/cli_proxy.obj		\
+-    $(SLO)$/cli_uno.obj
++    $(SLO)$/cli_uno.obj			\
++    $(SLO)$/cli_loaderwrapper.obj	\
+ 
+ SHL1OBJS = $(SLOFILES)
+-
++CALLBACKLIB = $(LB)$/icli_callback.lib
+ SHL1TARGET = $(TARGET)
+ 
+ SHL1STDLIBS = \
+     $(CPPULIB)			\
+     $(SALLIB)			\
+-    mscoree.lib
++    mscoree.lib			\
++    $(CALLBACKLIB) \
+ 
+ .IF "$(CCNUMVER)" >= "001399999999"
+ SHL1STDLIBS += \
+
+diff --git scp2/source/ooo/ure.scp scp2/source/ooo/ure.scp
+index 008df5d..4d16b0d 100755
+--- scp2/source/ooo/ure.scp
++++ scp2/source/ooo/ure.scp
+@@ -425,6 +425,25 @@ End
+ #endif
+
+ #if defined WNT && defined _MSC
++File gid_File_Dl_Cli_Loader
++    TXT_FILE_BODY;
++    Dir = SCP2_URE_DL_DIR;
++    Name = STRING(CONCAT4(cli_loader,DLLPOSTFIX,.uno,.dll));
++    Styles = (PACKED, UNO_COMPONENT, VERSION_INDEPENDENT_COMP_ID);
++    RegistryID = gid_Starregistry_Services_Rdb_Ure;
++End
++#endif
++
++#if defined WNT && defined _MSC
++File gid_File_Dl_Cli_Callback
++    TXT_FILE_BODY;
++    Dir = SCP2_URE_DL_DIR;
++    Name = STRING(CONCAT3(cli_callback,DLLPOSTFIX,.dll));
++    Styles = (PACKED, VERSION_INDEPENDENT_COMP_ID);
++End
++#endif
++
++#if defined WNT && defined _MSC
+
+ File gid_File_Dl_Cli_Ure_Assembly
+     TXT_FILE_BODY;
+diff --git cli_ure/prj/d.lst cli_ure/prj/d.lst
+index 261bb2c..4052b9c 100644
+--- cli_ure/prj/d.lst
++++ cli_ure/prj/d.lstt
+@@ -2,6 +2,8 @@
+ ..\%__SRC%\bin\climaker.pdb %_DEST%\bin%_EXT%\climaker.pdb
+ ..\%__SRC%\bin\climaker.exe.config %_DEST%\bin%_EXT%\climaker.exe.config
+ 
++..\%__SRC%\bin\cli_loader*.dll %_DEST%\bin%_EXT%\cli_loader*.dll
++..\%__SRC%\lib\cli_loader*.so %_DEST%\lib%_EXT%\cli_loader*.so
+ ..\%__SRC%\bin\cli_*.dll %_DEST%\bin%_EXT%\cli_*.dll
+ ..\%__SRC%\bin\cli_*.pdb %_DEST%\bin%_EXT%\cli_*.pdb
+ ..\%__SRC%\bin\cli_*.config %_DEST%\bin%_EXT%\cli_*.config
+--- /dev/null
++++ cli_ure/source/cli_loader/cli_loader.cxx
+@@ -0,0 +1,168 @@
++// MARKER(update_precomp.py): autogen include statement, do not remove
++#include "precompiled_cli_ure.hxx"
++#include <comphelper/processfactory.hxx>
++#include <comphelper/uno3.hxx>
++#include <com/sun/star/lang/XMultiComponentFactory.hpp>
++#include <com/sun/star/loader/XImplementationLoader.hpp>
++#include <com/sun/star/beans/XPropertySet.hpp>
++#include <com/sun/star/container/XNamed.hpp>
++#include <com/sun/star/lang/XServiceInfo.hpp>
++#include <com/sun/star/lang/XInitialization.hpp>
++#include <com/sun/star/util/XMacroExpander.hpp>
++#include <cppuhelper/implbase2.hxx>
++#include "uno/mapping.hxx"
++#ifdef WNT
++#include "cli_loader_wrapper.h"
++#endif
++#include <fstream.h>
++
++// for debug
++#include <comphelper/anytostring.hxx>
++
++using namespace ::com::sun::star;
++
++typedef ::cppu::WeakImplHelper2< loader::XImplementationLoader, lang::XServiceInfo > CliLoader_BASE;
++
++
++namespace cli_loader
++{
++    ::rtl::OUString SAL_CALL getImplementationName();
++
++    uno::Reference< uno::XInterface > SAL_CALL create( uno::Reference< uno::XComponentContext > const & xContext ) SAL_THROW( () );
++
++    uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames();
++}
++
++#ifdef WNT
++uno::Reference< loader::XImplementationLoader >
++create_object ()
++{
++    OSL_TRACE("In create_object for managed loader....");
++    // interact with managed c++
++    uno::Reference< loader::XImplementationLoader > xLoader = reinterpret_cast< loader::XImplementationLoader* >( getCLILoader() );
++    return xLoader;
++}
++#endif
++
++class CliLoader : public CliLoader_BASE
++{
++    uno::Reference< uno::XComponentContext > mxContext;
++    uno::Reference< loader::XImplementationLoader > mxLoader;
++    uno::Reference< util::XMacroExpander > mxExpander;
++public:
++    CliLoader( const uno::Reference< uno::XComponentContext >& rxContext ) : mxContext( rxContext )
++    {
++        OSL_TRACE("***** CliLoader::CliLoader() ");
++        if (!(mxContext->getValueByName( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/singletons/com.sun.star.util.theMacroExpander"))) >>= mxExpander)
++        || !mxExpander.is())
++        {
++            throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "component context fails to supply singleton" " com.sun.star.util.theMacroExpander of type" " com.sun.star.util.XMacroExpander")), mxContext);        
++        }
++#ifdef WNT
++        static uno::Reference< loader::XImplementationLoader > xLoader( create_object() );
++        mxLoader = xLoader;
++#else
++        uno::Reference< uno::XMultiComponentFactory > factory = mxContext->getServiceManager();
++        mxLoader = factory->createInstanceWithContext( rtl::OUString::createFromAscii("org.openoffice.loader.MonoLoader" ), mxContext ); 
++#endif
++        if ( mxLoader.is() )
++        {
++            // set the service factory
++            uno::Sequence< uno::Any > args(1);
++            args[ 0 ] <<= rxContext->getServiceManager();
++            uno::Reference< lang::XInitialization > xInitialize( mxLoader, uno::UNO_QUERY_THROW );
++            OSL_TRACE("CliLoader::CliLoader() about to call initialise");
++            xInitialize->initialize( args );
++        }
++        else 
++        {
++            OSL_TRACE("**  CliLoader::CliLoader(): No loader found ");
++        }
++
++    }
++    ~CliLoader()
++    {
++        OSL_TRACE("** CliLoader::~CliLoader() ");
++    }
++
++    // Methods
++    virtual uno::Reference< uno::XInterface > SAL_CALL activate( const ::rtl::OUString& implementationName, const ::rtl::OUString& implementationLoaderUrl, const ::rtl::OUString& locationUrl, const uno::Reference< registry::XRegistryKey >& xKey ) throw (loader::CannotActivateFactoryException, uno::RuntimeException)
++    {
++        // try to instatiate a mono loader and return a reference to it
++        OSL_TRACE("**** in CliLoader::activate");
++        if ( mxLoader.is() )
++        {
++            OSL_TRACE("*** CliLoader::activate() about to call activate on 0x%x", mxLoader.get() );
++             return mxLoader->activate( implementationName, implementationLoaderUrl, locationUrl, xKey );
++        }
++        return NULL;
++    }
++
++    virtual ::sal_Bool SAL_CALL writeRegistryInfo( const uno::Reference< registry::XRegistryKey >& xKey, const ::rtl::OUString& implementationLoaderUrl, const ::rtl::OUString& locationUrl ) throw (registry::CannotRegisterImplementationException, uno::RuntimeException)
++    { 
++        if ( mxLoader.is() )
++        {
++             return mxLoader->writeRegistryInfo( xKey, implementationLoaderUrl, locationUrl );
++        }
++        return sal_False;
++    }
++
++    virtual ::rtl::OUString SAL_CALL getImplementationName(  ) throw (uno::RuntimeException){ return cli_loader::getImplementationName(); }
++
++    virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (uno::RuntimeException)
++    {
++        sal_Bool bRes = sal_False;
++        uno::Sequence< ::rtl::OUString > sServices = cli_loader::getSupportedServiceNames();
++        const ::rtl::OUString* pService = sServices.getConstArray();
++        const ::rtl::OUString* pEnd = sServices.getConstArray() + sServices.getLength();
++        for ( ; pService != pEnd ;  ++pService )
++        {
++            if ( (*pService).equals( ServiceName ) )
++            {
++                bRes = sal_True;
++                break;
++            }
++        }
++        return bRes;
++    }
++
++    virtual uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames(  ) throw (uno::RuntimeException){ return cli_loader::getSupportedServiceNames(); }
++
++};
++
++namespace cli_loader
++{
++    ::rtl::OUString SAL_CALL getImplementationName()
++    {
++        static ::rtl::OUString* pImplName = 0;
++        if ( !pImplName )
++        {
++            ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
++            if ( !pImplName )
++            {
++                static ::rtl::OUString aImplName( RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.loader.CliLoader" ) );
++                pImplName = &aImplName;
++            }
++        }
++        return *pImplName;
++    }
++
++    uno::Reference< uno::XInterface > SAL_CALL create(
++    uno::Reference< uno::XComponentContext > const & xContext )
++    SAL_THROW( () )
++    {
++        OSL_TRACE("** In create for monoloader");
++        // mimic java loader, just hava a single entry point ( Mono implementation 
++        // loader )
++        // #FIXME use whatever boiler plate static initialisatioon foo that is 
++        // available ( seem to recall there is some helpers for that )
++        static uno::Reference < lang::XTypeProvider  > xLoader( new CliLoader( xContext ) );
++        return xLoader;
++    }
++
++    uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
++    {
++        const ::rtl::OUString strName( ::cli_loader::getImplementationName() );
++        return uno::Sequence< ::rtl::OUString >( &strName, 1 );
++    }	
++}
+diff --git cli_ure/source/cli_loader/cli_loader.xml cli_ure/source/cli_loader/cli_loader.xml
+new file mode 100644
+index 0000000..06e6c73
+--- /dev/null
++++ cli_ure/source/cli_loader/cli_loader.xml
+@@ -0,0 +1,26 @@
++<?xml version="1.0" encoding="UTF-8"?>
++<!DOCTYPE module-description PUBLIC "-//StarOffice//DTD ComponentDescription 1.0//EN" "module-description.dtd">
++<module-description xmlns:xlink="http://www.w3.org/1999/xlink">
++
++    <module-name>mono_loader</module-name>
++    
++    <component-description>
++        <author>Noel Power </author>
++        <name>Mono Loader</name>
++        <description>Loader for components located in mono assemblies</description>
++        <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
++        <language>c++</language>
++        <status value="drafts"/>
++        <supported-service>org.openoffice.loader.MonoLoader</supported-service>
++        <type>com.sun.star.uno.XComponentContext</type>        
++    </component-description>
++    
++    <project-build-dependency>cppuhelper</project-build-dependency>
++    <project-build-dependency>cppu</project-build-dependency>
++    <project-build-dependency>sal</project-build-dependency>
++
++    <runtime-module-dependency>cppuhelper3$(COM)</runtime-module-dependency>
++    <runtime-module-dependency>cppu3</runtime-module-dependency>
++    <runtime-module-dependency>sal3</runtime-module-dependency>
++    
++</module-description>
+diff --git cli_ure/source/cli_loader/makefile.mk cli_ure/source/cli_loader/makefile.mk
+new file mode 100644
+index 0000000..2cde26e
+--- /dev/null
++++ cli_ure/source/cli_loader/makefile.mk
+@@ -0,0 +1,81 @@
++#*************************************************************************
++#
++# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++# 
++# Copyright 2008 by Sun Microsystems, Inc.
++#
++# OpenOffice.org - a multi-platform office productivity suite
++#
++# $RCSfile: makefile.mk,v $
++#
++# $Revision: 1.0 $
++#
++# This file is part of OpenOffice.org.
++#
++# OpenOffice.org is free software: you can redistribute it and/or modify
++# it under the terms of the GNU Lesser General Public License version 3
++# only, as published by the Free Software Foundation.
++#
++# OpenOffice.org is distributed in the hope that it will be useful,
++# but WITHOUT ANY WARRANTY; without even the implied warranty of
++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++# GNU Lesser General Public License version 3 for more details
++# (a copy is included in the LICENSE file that accompanied this code).
++#
++# You should have received a copy of the GNU Lesser General Public License
++# version 3 along with OpenOffice.org.  If not, see
++# <http://www.openoffice.org/license.html>
++# for a copy of the LGPLv3 License.
++#
++#*************************************************************************
++
++PRJ=..$/..
++
++PRJNAME=cli_ure
++TARGET=cli_loader
++
++VISIBILITY_HIDDEN=TRUE
++NO_BSYMBOLIC=	TRUE
++ENABLE_EXCEPTIONS=TRUE
++COMP1TYPELIST=$(TARGET)
++COMPRDB=$(SOLARBINDIR)$/types.rdb
++
++# --- Settings -----------------------------------------------------
++
++.INCLUDE :  settings.mk
++CFLAGS+=$(MONO_CFLAGS)
++DLLPRE =
++
++# ------------------------------------------------------------------
++
++#.INCLUDE :  ..$/cppumaker.mk
++
++SLOFILES= \
++		$(SLO)$/service.obj \
++		$(SLO)$/cli_loader.obj \
++
++SHL1TARGET= $(TARGET)$(DLLPOSTFIX).uno
++SHL1IMPLIB=     i$(TARGET)
++
++SHL1VERSIONMAP=$(SOLARENV)/src/component.map
++SHL1DEF=$(MISC)$/$(SHL1TARGET).def
++DEF1NAME=$(SHL1TARGET)
++                                                                              
++SHL1STDLIBS= \
++                $(CPPUHELPERLIB) \
++		$(COMPHELPERLIB) \
++                $(CPPULIB) \
++                $(TOOLSLIB) \
++                $(SALLIB) \
++
++.IF "$(GUI)" == "WNT"
++                SHL1STDLIBS+= $(LB)$/icli_uno.lib
++.ENDIF
++
++                                                                              
++SHL1DEPN=
++SHL1LIBS=$(SLB)$/$(TARGET).lib
++
++# --- Targets ------------------------------------------------------
++
++.INCLUDE :	target.mk
+diff --git cli_ure/source/cli_loader/service.cxx cli_ure/source/cli_loader/service.cxx
+new file mode 100644
+index 0000000..dd38d85
+--- /dev/null
++++ cli_ure/source/cli_loader/service.cxx
+@@ -0,0 +1,104 @@
++/*************************************************************************
++ *
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ * 
++ * Copyright 2008 by Sun Microsystems, Inc.
++ *
++ * OpenOffice.org - a multi-platform office productivity suite
++ *
++ * $RCSfile: service.cxx,v $
++ * $Revision: 1.0 $
++ *
++ * This file is part of OpenOffice.org.
++ *
++ * OpenOffice.org is free software: you can redistribute it and/or modify
++ * it under the terms of the GNU Lesser General Public License version 3
++ * only, as published by the Free Software Foundation.
++ *
++ * OpenOffice.org is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++ * GNU Lesser General Public License version 3 for more details
++ * (a copy is included in the LICENSE file that accompanied this code).
++ *
++ * You should have received a copy of the GNU Lesser General Public License
++ * version 3 along with OpenOffice.org.  If not, see
++ * <http://www.openoffice.org/license.html>
++ * for a copy of the LGPLv3 License.
++ *
++ ************************************************************************/
++
++// MARKER(update_precomp.py): autogen include statement, do not remove
++#include "precompiled_cli_ure.hxx"
++#include "cppuhelper/implementationentry.hxx"
++#include "com/sun/star/lang/XMultiServiceFactory.hpp"
++#include "com/sun/star/registry/XRegistryKey.hpp"
++
++// =============================================================================
++// component exports
++// =============================================================================
++using namespace ::com::sun::star;
++using namespace ::com::sun::star::uno;
++
++namespace cli_loader
++{
++    // =============================================================================
++    // component operations
++    // =============================================================================
++
++    uno::Reference< XInterface > SAL_CALL create(
++        Reference< XComponentContext > const & xContext )
++        SAL_THROW( () );
++
++    // -----------------------------------------------------------------------------
++
++    ::rtl::OUString SAL_CALL getImplementationName();
++
++    Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames();
++
++    Reference<XInterface> SAL_CALL create(
++        Sequence<Any> const &, Reference<XComponentContext> const & );
++} // end mono_loader
++
++
++    // =============================================================================
++
++    const ::cppu::ImplementationEntry s_component_entries [] =
++    {
++        {
++            ::cli_loader::create, ::cli_loader::getImplementationName,
++            ::cli_loader::getSupportedServiceNames, 
++            ::cppu::createSingleComponentFactory,
++            0, 0
++        },
++        { 0, 0, 0, 0, 0, 0 }
++    };
++
++extern "C"
++{
++    SAL_DLLPUBLIC_EXPORT  void SAL_CALL component_getImplementationEnvironment( 
++        const sal_Char ** ppEnvTypeName, uno_Environment ** )
++    {
++        OSL_TRACE("In component_getImplementationEnv");
++        *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
++    }
++
++    SAL_DLLPUBLIC_EXPORT  sal_Bool SAL_CALL component_writeInfo( 
++        lang::XMultiServiceFactory * pServiceManager, registry::XRegistryKey * pRegistryKey )
++    {
++        OSL_TRACE("In component_writeInfo");
++        if ( ::cppu::component_writeInfoHelper(
++            pServiceManager, pRegistryKey, s_component_entries ) )
++            return sal_True;
++        return sal_False;
++    }
++
++    SAL_DLLPUBLIC_EXPORT  void * SAL_CALL component_getFactory( 
++        const sal_Char * pImplName, lang::XMultiServiceFactory * pServiceManager,
++        registry::XRegistryKey * pRegistryKey )
++    {
++        OSL_TRACE("In component_getFactory");
++        return ::cppu::component_getFactoryHelper( 
++            pImplName, pServiceManager, pRegistryKey, s_component_entries );
++    }
++}
diff --git a/patches/dev300/cli-mono-common.diff b/patches/dev300/cli-mono-common.diff
new file mode 100644
index 0000000..aca5055
--- /dev/null
+++ b/patches/dev300/cli-mono-common.diff
@@ -0,0 +1,504 @@
+diff --git cli_ure/source/ure/makefile.mk cli_ure/source/ure/makefile.mk
+index 3e02908..91c122f 100644
+--- cli_ure/source/ure/makefile.mk
++++ cli_ure/source/ure/makefile.mk
+@@ -41,6 +41,12 @@ TARGET = ure
+ 
+ .INCLUDE : $(BIN)$/cliureversion.mk
+ 
++TMPCSC = $(CSC)
++
++.IF "$(ENABLE_MONO)" == "YES"
++TMPCSC = gmcs
++.ENDIF
++
+ ASSEMBLY_ATTRIBUTES = $(MISC)$/assembly_ure_$(TARGET).cs
+ 
+ POLICY_ASSEMBLY_FILE=$(BIN)$/$(CLI_URE_POLICY_ASSEMBLY).dll
+@@ -57,6 +63,9 @@ CSFILES = \
+     uno$/util$/WeakAdapter.cs					\
+     uno$/util$/WeakBase.cs						\
+     uno$/util$/WeakComponentBase.cs	\
++    uno$/util$/RegistrationClassFinder.cs \
++    uno$/util$/Factory.cs \
++    uno$/util$/ManagedCodeLoader.cs \
+     $(ASSEMBLY_ATTRIBUTES)
+ 
+ .IF "$(CCNUMVER)" <= "001399999999"
+@@ -74,11 +83,12 @@ $(ASSEMBLY_ATTRIBUTES) : assembly.cs makefile.mk $(BIN)$/cliuno.snk $(BIN)$/cliu
+     >> $@
+ .ENDIF
+ 
+-$(BIN)$/cli_ure.dll : $(CSFILES) $(BIN)$/cli_uretypes.dll $(BIN)$/cliureversion.mk 
+-    $(CSC) $(CSCFLAGS) \
++$(BIN)$/cli_ure.dll : $(CSFILES) $(BIN)$/cli_uretypes.dll $(BIN)$/cliureversion.mk $(BIN)$/cli_basetypes.dll
++    $(TMPCSC) $(CSCFLAGS) \
+         -target:library \
+         -out:$@ \
+         -reference:$(OUT)$/bin$/cli_uretypes.dll \
++        -reference:$(OUT)$/bin$/cli_basetypes.dll \
+         -reference:System.dll \
+         $(CSFILES)
+     @echo "If code has changed then provide a policy assembly and change the version!"
+diff --git cli_ure/source/ure/uno/util/Factory.cs cli_ure/source/ure/uno/util/Factory.cs
+new file mode 100644
+index 0000000..35b298e
+--- /dev/null
++++ cli_ure/source/ure/uno/util/Factory.cs
+@@ -0,0 +1,180 @@
++using System;
++using System.Reflection;
++
++using unoidl.com.sun.star.lang;
++using unoidl.com.sun.star.uno;
++using unoidl.com.sun.star.registry;
++namespace uno.util {
++
++public class Factory : WeakComponentBase , unoidl.com.sun.star.lang.XSingleComponentFactory, unoidl.com.sun.star.lang.XServiceInfo
++{
++    public static XSingleComponentFactory createComponentFactory(
++        Type impl_class, String[] supported_services )
++    {
++        return new Factory( impl_class, supported_services );
++    }
++
++    public static bool writeRegistryServiceInfo(
++        String impl_name, String[] supported_services, XRegistryKey xKey )
++    {
++        Console.WriteLine( "#####  HERE ##### ");
++        try
++        {
++            Console.WriteLine( "##### " + typeof( Factory ).ToString() + ".writeRegistryServiceInfo creating new key for SERVICES" );
++ 
++            unoidl.com.sun.star.registry.XRegistryKey xNewKey = xKey.createKey( "/" + impl_name + "/UNO/SERVICES" );
++            for ( int nPos = 0; nPos < supported_services.Length; ++nPos )
++            {
++                xNewKey.createKey( supported_services[ nPos ] );
++                Console.WriteLine( "##### " + typeof( Factory ).ToString() + ".writeRegistryServiceInfo created new key fo " + supported_services[ nPos ] );
++            }
++            return true;
++        }
++        catch ( unoidl.com.sun.star.registry.InvalidRegistryException exc)
++        {
++            Console.WriteLine( "##### " + typeof( Factory ).ToString() + ".writeRegistryServiceInfo - exc: " + exc );
++        }
++        return false;
++    }
++    
++    private String m_impl_name;
++    private String [] m_supported_services;
++    private Type m_impl_class;
++    private MethodInfo m_method;
++    private ConstructorInfo m_ctor;
++    
++    // ctor
++    private Factory( Type impl_class, String[] supported_services )
++    {
++        m_impl_name = impl_class.ToString();
++        m_supported_services = supported_services;
++        m_impl_class = impl_class;
++        m_method = null;
++        m_ctor = null;
++        
++        Type[] mparams = { typeof ( unoidl.com.sun.star.uno.XComponentContext ) };
++        
++        try
++        {
++            // seeking for "public static Object __create( XComponentContext )"
++            m_method = m_impl_class.GetMethod("__create", BindingFlags.Public | BindingFlags.Static, null, CallingConventions.Any, mparams, null );
++            if ( m_method.ReturnType != typeof ( Object ) )
++                m_method = null;
++        }
++        catch (System.Exception /*exc*/)
++        {
++        }
++        
++        if (null == m_method)
++        {
++            try
++            {
++                Console.WriteLine( "searching for ctor with unoidl.com.sun.star.uno.XComponentContext ");
++                // ctor with context
++                m_ctor = m_impl_class.GetConstructor( new Type[] { typeof ( unoidl.com.sun.star.uno.XComponentContext ) }  );
++                Console.WriteLine( "found ctor ? " + ( m_ctor != null ).ToString() );
++            
++            }
++            catch (System.Exception /*exc*/)
++            {
++
++                // else take default ctor
++                m_ctor = m_impl_class.GetConstructor(null);
++            }
++        }
++    }
++    
++    //______________________________________________________________________________________________
++    private Object instantiate( XComponentContext xContext )
++//        throws com.sun.star.uno.Exception
++    {
++        try
++        {
++            Console.WriteLine( "instantiating " + m_impl_class.ToString() + " using " );
++            if (null != m_method)
++            {
++                Console.WriteLine( "\t__create( XComponentContext )..." );
++                return m_method.Invoke( null, new Object [] { xContext } );
++            }
++            if (null != m_ctor)
++            {
++                Console.WriteLine( "\tctor( XComponentContext )..." );
++                return m_ctor.Invoke( new Object[] { xContext } );
++            }
++            Console.WriteLine( "\tdefault ctor ..." );
++            // #FIXME check this
++            return m_impl_class.GetConstructor(null).Invoke(null); // default ctor
++        }
++        catch ( System.Exception e )
++        {
++            Console.WriteLine( "\tcontructing component " + m_impl_class.ToString() + " failed exc: " + e );
++            throw new unoidl.com.sun.star.uno.RuntimeException( e.ToString(), null );
++        }
++        // #FIXME sort out the exception foo below
++/*
++        catch (java.lang.reflect.InvocationTargetException exc)
++        {
++            Throwable targetException = exc.getTargetException();
++            if (targetException instanceof java.lang.RuntimeException)
++                throw (java.lang.RuntimeException)targetException;
++            else if (targetException instanceof com.sun.star.uno.RuntimeException)
++                throw (com.sun.star.uno.RuntimeException)targetException;
++            else if (targetException instanceof com.sun.star.uno.Exception)
++                throw (com.sun.star.uno.Exception)targetException;
++            else
++                throw new com.sun.star.uno.Exception( targetException.toString(), this );
++        }
++        catch (IllegalAccessException exc)
++        {
++            throw new com.sun.star.uno.RuntimeException( exc.toString(), this );
++        }
++        catch (InstantiationException exc)
++        {
++            throw new com.sun.star.uno.RuntimeException( exc.toString(), this );
++        }
++*/
++    }
++    // XSingleComponentFactory impl
++    //______________________________________________________________________________________________
++    public Object createInstanceWithContext(
++        unoidl.com.sun.star.uno.XComponentContext xContext )
++//        throws com.sun.star.uno.Exception
++    {
++        return instantiate( xContext );
++    }
++    //______________________________________________________________________________________________
++    public Object createInstanceWithArgumentsAndContext(
++        uno.Any[] arguments, unoidl.com.sun.star.uno.XComponentContext xContext )
++//        throws com.sun.star.uno.Exception
++    {
++        Object inst = instantiate( xContext );
++        unoidl.com.sun.star.lang.XInitialization xInit = ( unoidl.com.sun.star.lang.XInitialization ) inst;
++        xInit.initialize( arguments );
++        return inst;
++    }
++    
++    // XServiceInfo impl
++    //______________________________________________________________________________________________
++    public String getImplementationName()
++    {
++        return m_impl_name;
++    }
++    //______________________________________________________________________________________________
++    public bool supportsService( String service_name )
++    {
++        for ( int nPos = 0; nPos < m_supported_services.Length; ++nPos )
++        {
++            if (m_supported_services[ nPos ] == service_name )
++                return true;
++        }
++        return false;
++    }
++    //______________________________________________________________________________________________
++    public String [] getSupportedServiceNames()
++    {
++        return m_supported_services;
++    }
++}
++
++}
++
+diff --git cli_ure/source/ure/uno/util/ManagedCodeLoader.cs cli_ure/source/ure/uno/util/ManagedCodeLoader.cs
+new file mode 100644
+index 0000000..e8b23d6
+--- /dev/null
++++ cli_ure/source/ure/uno/util/ManagedCodeLoader.cs
+@@ -0,0 +1,197 @@
++using System;
++using System.Reflection;
++
++using unoidl.com.sun.star.lang;
++using unoidl.com.sun.star.uno;
++using unoidl.com.sun.star.registry;
++
++namespace uno.util
++{
++  
++
++// loader for cs components
++public class ManagedCodeLoader : uno.util.WeakBase, unoidl.com.sun.star.loader.XImplementationLoader, unoidl.com.sun.star.lang.XServiceInfo, unoidl.com.sun.star.lang.XInitialization
++{
++    private unoidl.com.sun.star.lang.XMultiServiceFactory multiServiceFactory;
++    private String[] supportedServices = {
++        "com.sun.star.loader.ManagedCodeLoader"
++    };
++
++    private unoidl.com.sun.star.util.XMacroExpander m_xMacroExpander = null;
++    private String EXPAND_PROTOCOL_PREFIX = "vnd.sun.star.expand:";
++
++    /** Expands macrofied url using the macro expander singleton.
++     */
++    private String expand_url( String url )
++    {
++            Console.WriteLine( "#1 expand_url " + url );
++
++        if (url != null && url.StartsWith( EXPAND_PROTOCOL_PREFIX ))
++        {
++            try
++            {
++                if (m_xMacroExpander == null)
++                {
++                    Console.WriteLine( "#2 attempt to get macroexpander ");
++                    unoidl.com.sun.star.beans.XPropertySet xProps = ( unoidl.com.sun.star.beans.XPropertySet ) multiServiceFactory;
++                    if (xProps == null)
++                    {
++                        throw new unoidl.com.sun.star.uno.RuntimeException(
++                            "service manager does not support XPropertySet!",
++                            this );
++                    }
++                    unoidl.com.sun.star.uno.XComponentContext xContext = (unoidl.com.sun.star.uno.XComponentContext) xProps.getPropertyValue( "DefaultContext" ).Value;
++                    m_xMacroExpander = ( unoidl.com.sun.star.util.XMacroExpander )xContext.getValueByName( "/singletons/com.sun.star.util.theMacroExpander" ).Value;
++                    Console.WriteLine( "#3 got macroexpander ");
++                }
++                /* #FIXME there must be a better way of doing this
++                   1. the Uri.UnescapeDataString is not available
++                   for mono on sled ( not sure about what later versions on
++                   other platforms provide
++                   2. unescape probably won't do exactly what we want
++                   3. unescape besides being deprecated is protected :-/ hence
++                      MyCrappyDecoder 
++                */
++                // decode uric class chars
++                String macro = System.Uri.UnescapeDataString( url.Substring( EXPAND_PROTOCOL_PREFIX.Length ).Replace( "+", "%2B" ) );
++                Console.WriteLine( "#4 decoded url " + macro);
++                // expand macro string
++                String ret = m_xMacroExpander.expandMacros( macro );
++                Console.WriteLine( "#5 decoded & expanded url " + ret);
++                return ret;
++            }
++            catch (unoidl.com.sun.star.uno.Exception exc)
++            {
++                throw new unoidl.com.sun.star.uno.RuntimeException(
++                    exc.ToString(), this );
++            }
++            catch ( System.Exception exc)
++            {
++                throw new unoidl.com.sun.star.uno.RuntimeException(
++                    exc.ToString(), this );
++            }
++        }
++        return url;
++    }
++
++    // XImplementationLoader 
++    public System.Object activate(String implementationName, String implementationLoaderUrl, String locationUrl, unoidl.com.sun.star.registry.XRegistryKey key )
++    {
++        locationUrl = expand_url( locationUrl ); 
++        Console.WriteLine( "*** *** ManagedCodeLoader.activate( " +  implementationName + ", " + implementationLoaderUrl + ", " + locationUrl + ") ****" );
++        // implementationName will be the class ( or Type ) name
++        // locationUrl is the name of the assembly it will be in
++        
++        // here's a cheap and nasty facimile of what the java loader does
++        Type clazz = null;
++
++        try
++        {
++            clazz = RegistrationClassFinder.find( locationUrl );
++        }
++        catch (System.NullReferenceException e)
++        {
++            throw new unoidl.com.sun.star.loader.CannotActivateFactoryException( "can not activate exception because " + implementationName + "\nexc: " + e, null );
++        }
++        catch (System.Exception e)
++        {
++            throw new unoidl.com.sun.star.loader.CannotActivateFactoryException( "can not activate exception because " + implementationName + "\nexc: " + e, null );
++        }
++
++        System.Object returnObject = null;
++        MethodInfo compfac_method;
++        try
++        {
++            Type[] compParams = { typeof(String) };
++            compfac_method =  clazz.GetMethod( "__getComponentFactory" , compParams );
++            if ( compfac_method != null )
++            {
++                Object ret = compfac_method.Invoke( clazz, new Object [] { implementationName } );
++                if ( ret != null )
++                    returnObject = ( unoidl.com.sun.star.lang.XSingleComponentFactory )ret;
++            }
++    
++        }
++        catch ( System.Exception e )
++        {
++            throw new unoidl.com.sun.star.loader.CannotActivateFactoryException( "Failed to activate factory for " + implementationName + "\nexc: " + e, null );
++        }
++        return returnObject;
++    }
++    public bool writeRegistryInfo(unoidl.com.sun.star.registry.XRegistryKey key, String implementationLoaderUrl, String locationUrl)
++    {
++        locationUrl = expand_url( locationUrl ); 
++        Console.WriteLine( "*** H E R E *** ManagedCodeLoader.writeRegistryInfo( " + implementationLoaderUrl  + ", " +  locationUrl + ") ****" );
++        bool bReturn = false;
++        // implementationName will be the class ( or Type ) name
++        // locationUrl is the name of the assembly it will be in
++        
++        // here's a cheap and nasty facsimile of what the java loader does
++        Type clazz = null;
++
++        try
++        {
++            Console.WriteLine( "*** *** ManagedCodeLoader.writeRegistryInfo( " + implementationLoaderUrl  + ", " +  locationUrl + ") ABOUT to call find :-/ ****" );
++            clazz = RegistrationClassFinder.find( locationUrl );
++        }
++        catch (System.NullReferenceException /*e*/ )
++        {
++            throw new unoidl.com.sun.star.registry.CannotRegisterImplementationException(  "Failed to find " + clazz.ToString(), null );
++        }
++        catch (System.Exception e )
++        {
++            throw new unoidl.com.sun.star.registry.CannotRegisterImplementationException(  e.ToString(), null );
++        }
++        MethodInfo compfac_method;
++        try
++        {
++            Type[] regParams = { typeof(unoidl.com.sun.star.registry.XRegistryKey ) };
++            compfac_method =  clazz.GetMethod( "__writeRegistryServiceInfo" , regParams );
++            if ( compfac_method != null )
++            {
++                Object ret = compfac_method.Invoke( clazz, new Object [] { key } );
++                if ( ret != null )
++                    bReturn = ( bool )ret;
++            }
++    
++        }
++        catch ( System.Exception e )
++        {
++            throw new unoidl.com.sun.star.registry.CannotRegisterImplementationException(  e.ToString(), null );
++        }
++        return bReturn;
++
++    }
++    // XInitialization
++    public void initialize( uno.Any[] args )
++    {
++        Console.WriteLine( "*** *** Entering ManagedCodeLoader.initialize() ");
++        if ( args.Length == 0 )
++            // probably need to change to uno.Exception
++            throw new System.Exception("No arguments passed to initialize");
++        multiServiceFactory = (unoidl.com.sun.star.lang.XMultiServiceFactory)args[0].Value;
++        if ( multiServiceFactory == null )
++            Console.WriteLine( " Bad multiservice factory " );
++        Console.WriteLine( "*** *** Leaving ManagedCodeLoader.initialize() ");
++        
++    }
++    // XServiceInfo
++    public String getImplementationName() 
++    {
++        return GetType().ToString();
++    }    
++    public bool supportsService(String serviceName) 
++    {
++        for ( int i = 0; i < supportedServices.Length; i++ ) {
++            if ( supportedServices[i] == serviceName )
++                return true;
++        }
++        return false;
++    }
++    public String[] getSupportedServiceNames() 
++    {
++        return supportedServices;
++    }    
++}
++
++}
+diff --git cli_ure/source/ure/uno/util/RegistrationClassFinder.cs cli_ure/source/ure/uno/util/RegistrationClassFinder.cs
+new file mode 100644
+index 0000000..4f16d79
+--- /dev/null
++++ cli_ure/source/ure/uno/util/RegistrationClassFinder.cs
+@@ -0,0 +1,33 @@
++using System;
++using System.Reflection;
++
++namespace uno.util
++{
++public class RegistrationClassFinder
++{
++    public static Type find( String url )
++    {
++        // LoadFrom can't handle escaped urls 
++        // #FIXME how does one do this in CSharp
++        Console.WriteLine( "## Find Url {0}", url );
++        url =  System.Uri.UnescapeDataString( url );
++        Console.WriteLine( "## Find Url escaped {0}", url );
++        url = url.Replace( "%20"," " ) ;
++        Console.WriteLine( "## after tweaking Url escaped {0}", url );
++        Assembly assem = Assembly.LoadFrom( url );
++        // we expect a component providing assembly to provide a Registration class
++        // name. The name is in the static field 'name' of a class called 
++        // 'component.RegistrationClass'. The 'name' is the actual name of the 
++        // class that provides the following component methods
++        // __getComponentFactory & __writeRegistryServiceInfo that are needed by the
++        // loader
++        // Of course we could use someother method, maybe bury the name in 
++        // the component.dll.config ?
++        FieldInfo f = assem.GetType("component.RegistrationClass").GetField( "name", BindingFlags.Public | BindingFlags.Static );
++        String sTypeName = (String)f.GetValue( null );
++        // Try to find the RegistrationClass
++        return assem.GetType( sTypeName );
++        
++    }
++}
++}
+diff --git desktop/source/deployment/registry/component/dp_component.cxx desktop/source/deployment/registry/component/dp_component.cxx
+index 9ae71d5..38d6a69 100644
+--- desktop/source/deployment/registry/component/dp_component.cxx
++++ desktop/source/deployment/registry/component/dp_component.cxx
+@@ -720,6 +720,16 @@ Reference<deployment::XPackage> BackendImpl::bindPackage_(
+                                 OUSTR("com.sun.star.loader.Python"),
+                                 bRemoved, identifier);
+                         }
++                        if (value.EqualsIgnoreCaseAscii("Mono") || value.EqualsIgnoreCaseAscii("Cli") ){
++                            return new BackendImpl::ComponentPackageImpl(
++                                this, url, name, m_xPythonComponentTypeInfo,
++ #if WNT
++                                OUSTR("org.openoffice.loader.CliLoader"),
++ #else
++                                OUSTR("org.openoffice.loader.MonoLoader"),
++ #endif
++                                bRemoved, identifier);
++                        }
+                     }
+                 }
+             }
+
+diff --git cli_ure/prj/build.lst cli_ure/prj/build.lst
+index 268240c..bb595ae 100644
+--- cli_ure/prj/build.lst
++++ cli_ure/prj/build.lst
+@@ -6,7 +6,7 @@ ure	cli_ure\source				nmake   -   w,vc7   ure_source_source ure_inc NULL
+ ure	cli_ure\source\basetypes	nmake	-	w,vc7	ure_source_basetypes ure_source_version ure_source_source.w ure_inc NULL
+ ure	cli_ure\source\climaker		nmake	-	w,vc7	ure_source_climaker ure_source_basetypes.w ure_inc NULL
+ ure	cli_ure\unotypes			nmake	-	w,vc7	ure_unotypes ure_source_version ure_source_source.w ure_source_climaker.w ure_inc NULL
+-ure	cli_ure\source\ure			nmake	-	w,vc7	ure_source_ure ure_source_version ure_source_source.w ure_unotypes.w ure_inc NULL
++ure	cli_ure\source\ure			nmake	-	w,vc7	ure_source_ure ure_source_version ure_source_source.w ure_source_basetypes.w ure_unotypes.w ure_inc NULL
+ ure	cli_ure\source\uno_bridge	nmake	-	w,vc7	ure_source_uno_bridge ure_source_basetypes.w ure_unotypes.w ure_source_ure.w ure_inc NULL
+ ure	cli_ure\source\native		nmake	-	w,vc7	ure_source_native ure_source_version ure_source_source.w ure_source_ure.w ure_unotypes.w ure_source_uno_bridge.w ure_inc NULL
diff --git a/patches/mono/cli_ure-mono-bridge.diff b/patches/mono/cli_ure-mono-bridge.diff
index f8f81f6..2f971ee 100644
--- a/patches/mono/cli_ure-mono-bridge.diff
+++ b/patches/mono/cli_ure-mono-bridge.diff
@@ -36,7 +36,7 @@ index 268240c..ea7b486 100644
 +++ cli_ure/prj/build.lst
 @@ -8,6 +8,7 @@ ure	cli_ure\source\climaker		nmake	-	w,vc7	ure_source_climaker ure_source_basety
  ure	cli_ure\unotypes			nmake	-	w,vc7	ure_unotypes ure_source_version ure_source_source.w ure_source_climaker.w ure_inc NULL
- ure	cli_ure\source\ure			nmake	-	w,vc7	ure_source_ure ure_source_version ure_source_source.w ure_unotypes.w ure_inc NULL
+ ure	cli_ure\source\ure			nmake	-	w,vc7	ure_source_ure ure_source_version ure_source_source.w ure_source_basetypes.w ure_unotypes.w ure_inc NULL
  ure	cli_ure\source\uno_bridge	nmake	-	w,vc7	ure_source_uno_bridge ure_source_basetypes.w ure_unotypes.w ure_source_ure.w ure_inc NULL
 +ure	cli_ure\source\mono_bridge      nmake   -       u       ure_source_mono_bridge ure_unotypes ure_source_ure ure_inc NULL
  ure	cli_ure\source\native		nmake	-	w,vc7	ure_source_native ure_source_version ure_source_source.w ure_source_ure.w ure_unotypes.w ure_source_uno_bridge.w ure_inc NULL
diff --git a/patches/mono/cli_ure-prj-build-lst.diff b/patches/mono/cli_ure-prj-build-lst.diff
index 5a5f874..c7cf0f8 100644
--- a/patches/mono/cli_ure-prj-build-lst.diff
+++ b/patches/mono/cli_ure-prj-build-lst.diff
@@ -14,8 +14,8 @@ index 00f7f53..23761c0 100644
 +ure	cli_ure\source\bootstrap        nmake   -       u       ure_source_bootstrap ure_source_climaker ure_source_source ure_source_basetypes ure_inc ure_unotypes NULL
  ure	cli_ure\source\climaker         nmake   -       all     ure_source_climaker ure_source_basetypes ure_inc NULL
  ure	cli_ure\unotypes				nmake   -       all     ure_unotypes ure_source_version ure_source_source ure_source_climaker ure_source_basetypes ure_inc NULL
--ure	cli_ure\source\ure				nmake   -       all     ure_source_ure ure_source_version ure_source_source ure_unotypes ure_inc NULL
-+ure	cli_ure\source\ure                      nmake   -       all     ure_source_ure ure_source_bootstrap.u ure_source_version ure_source_source ure_unotypes ure_inc NULL
+-ure	cli_ure\source\ure				nmake   -       all     ure_source_ure ure_source_version ure_source_source ure_source_basetypes ure_unotypes ure_inc NULL
++ure	cli_ure\source\ure                      nmake   -       all     ure_source_ure ure_source_bootstrap.u ure_source_version ure_source_source ure_source_basetypes ure_unotypes ure_inc NULL
  ure	cli_ure\source\uno_bridge		nmake	-		w,vc7	ure_source_uno_bridge ure_source_basetypes ure_unotypes ure_source_ure ure_inc NULL
  ure	cli_ure\source\mono_bridge      nmake   -       u       ure_source_mono_bridge ure_unotypes ure_source_ure ure_inc NULL
  ure	cli_ure\source\native           nmake   -       w,vc7   ure_source_native ure_source_version ure_source_source ure_source_ure ure_unotypes ure_source_uno_bridge ure_inc NULL
diff --git a/patches/mono/mono-build-keyfile.diff b/patches/mono/mono-build-keyfile.diff
index e2694fe..4eab12c 100644
--- a/patches/mono/mono-build-keyfile.diff
+++ b/patches/mono/mono-build-keyfile.diff
@@ -76,7 +76,7 @@ index 2a3c16b..bc1b962 100644
  .ENDIF
  
 @@ -59,7 +59,7 @@ CSFILES = \
-     uno$/util$/WeakComponentBase.cs	\
+     uno$/util$/ManagedCodeLoader.cs \
      $(ASSEMBLY_ATTRIBUTES)
  
 -.IF "$(CCNUMVER)" <= "001399999999"
diff --git a/patches/mono/mono-build.diff b/patches/mono/mono-build.diff
index 49920e7..4c6c20c 100644
--- a/patches/mono/mono-build.diff
+++ b/patches/mono/mono-build.diff
@@ -22,14 +22,14 @@ index ea7b486..00f7f53 100644
 -ure	cli_ure\source\basetypes	nmake	-	w,vc7	ure_source_basetypes ure_source_version ure_source_source.w ure_inc NULL
 -ure	cli_ure\source\climaker		nmake	-	w,vc7	ure_source_climaker ure_source_basetypes.w ure_inc NULL
 -ure	cli_ure\unotypes			nmake	-	w,vc7	ure_unotypes ure_source_version ure_source_source.w ure_source_climaker.w ure_inc NULL
--ure	cli_ure\source\ure			nmake	-	w,vc7	ure_source_ure ure_source_version ure_source_source.w ure_unotypes.w ure_inc NULL
+-ure	cli_ure\source\ure			nmake	-	w,vc7	ure_source_ure ure_source_version ure_source_source.w ure_source_basetypes.w ure_unotypes.w ure_inc NULL
 -ure	cli_ure\source\uno_bridge	nmake	-	w,vc7	ure_source_uno_bridge ure_source_basetypes.w ure_unotypes.w ure_source_ure.w ure_inc NULL
 +ure	cli_ure\source					nmake   -		all		ure_source_source ure_inc NULL
 +ure	cli_ure\source\basetypes        nmake   -       all     ure_source_basetypes ure_source_version ure_source_source ure_inc NULL
 +ure	cli_ure\source\bootstrap        nmake   -       u       ure_source_bootstrap ure_source_source ure_source_basetypes ure_inc NULL
 +ure	cli_ure\source\climaker         nmake   -       all     ure_source_climaker ure_source_basetypes ure_inc NULL
 +ure	cli_ure\unotypes				nmake   -       all     ure_unotypes ure_source_version ure_source_source ure_source_climaker ure_source_basetypes ure_inc NULL
-+ure	cli_ure\source\ure				nmake   -       all     ure_source_ure ure_source_version ure_source_source ure_unotypes ure_inc NULL
++ure	cli_ure\source\ure				nmake   -       all     ure_source_ure ure_source_version ure_source_source ure_source_basetypes ure_unotypes ure_inc NULL
 +ure	cli_ure\source\uno_bridge		nmake	-		w,vc7	ure_source_uno_bridge ure_source_basetypes ure_unotypes ure_source_ure ure_inc NULL
  ure	cli_ure\source\mono_bridge      nmake   -       u       ure_source_mono_bridge ure_unotypes ure_source_ure ure_inc NULL
 -ure	cli_ure\source\native		nmake	-	w,vc7	ure_source_native ure_source_version ure_source_source.w ure_source_ure.w ure_unotypes.w ure_source_uno_bridge.w ure_inc NULL
diff --git a/patches/mono/mono-component-support.diff b/patches/mono/mono-component-support.diff
new file mode 100644
index 0000000..04a33d3
--- /dev/null
+++ b/patches/mono/mono-component-support.diff
@@ -0,0 +1,627 @@
+diff --git cli_ure/source/mono_bridge/bridge.cs cli_ure/source/mono_bridge/bridge.cs
+index 20f1ecc..1fe6184 100644
+--- cli_ure/source/mono_bridge/bridge.cs
++++ cli_ure/source/mono_bridge/bridge.cs
+@@ -1679,9 +1679,9 @@ public unsafe class Bridge
+ 
+         for (int i = 0; i < nParams; ++i)
+         {
+-            // FIXME it's a TypeDescriptionReference
+-            TypeDescription *type = (TypeDescription *)parameters[i].pTypeRef;
+-
++            TypeDescriptionReference *typeref = (TypeDescriptionReference *)parameters[i].pTypeRef;
++            TypeDescription *type = null;
++            TypeDescriptionReference.GetDescription(&type, typeref);
+             unoArgPtrs[i] = unoArgs + i;
+             if ((type->eTypeClass == TypeClass.STRUCT ||
+                  type->eTypeClass == TypeClass.EXCEPTION) &&
+@@ -1696,7 +1696,7 @@ public unsafe class Bridge
+             if (parameters[i].bIn != 0)
+             {
+                 // FIXME error handling
+-                MapToUno(unoArgPtrs[i], args[i], type, false /* no assign */);
++                MapToUno(unoArgPtrs[i], args[i], (TypeDescription*)typeref, false /* no assign */);
+             }
+         }
+ 
+@@ -1828,13 +1828,27 @@ public unsafe class Bridge
+                 MapToManaged(ref args[i], unoArgs[i], parameters[i].pTypeRef, null, false);
+ 
+         object invocationResult = null;
++        Exception exc = null;
+         try
+         {
+             invocationResult = method.Invoke(managedI, args);
+         }
+         catch (TargetInvocationException e)
+         {
+-            Exception exc = e.InnerException;
++            exc = e.InnerException;
++        }
++        catch (Exception e)
++        {
++            exc = e;
++        }
++        if ( exc != null )
++        {
++            if ( !( exc is unoidl.com.sun.star.uno.Exception ) )
++            {
++                // #FIXME put more info in here trace, stack etc. ( when I
++                // figure out how to do that in mono )
++                exc = new unoidl.com.sun.star.uno.RuntimeException( exc.ToString(), null );
++            }
+             TypeDescription* td = null;
+             // FIXME leak
+             TypeDescriptionReference.GetDescription(&td, MapManagedType(exc.GetType()));
+@@ -1844,11 +1858,6 @@ public unsafe class Bridge
+             (*unoExc)->pData = memExc;
+             return;
+         }
+-        catch (Exception e)
+-        {
+-            // FIXME
+-        }
+-
+         // convert out, in/out params
+         for (int i = 0; i < nParams; ++i)
+         {
+diff --git cli_ure/source/mono_loader/makefile.mk cli_ure/source/mono_loader/makefile.mk
+new file mode 100644
+index 0000000..6fadcd2
+--- /dev/null
++++ cli_ure/source/mono_loader/makefile.mk
+@@ -0,0 +1,78 @@
++#*************************************************************************
++#
++# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++# 
++# Copyright 2008 by Sun Microsystems, Inc.
++#
++# OpenOffice.org - a multi-platform office productivity suite
++#
++# $RCSfile: makefile.mk,v $
++#
++# $Revision: 1.0 $
++#
++# This file is part of OpenOffice.org.
++#
++# OpenOffice.org is free software: you can redistribute it and/or modify
++# it under the terms of the GNU Lesser General Public License version 3
++# only, as published by the Free Software Foundation.
++#
++# OpenOffice.org is distributed in the hope that it will be useful,
++# but WITHOUT ANY WARRANTY; without even the implied warranty of
++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++# GNU Lesser General Public License version 3 for more details
++# (a copy is included in the LICENSE file that accompanied this code).
++#
++# You should have received a copy of the GNU Lesser General Public License
++# version 3 along with OpenOffice.org.  If not, see
++# <http://www.openoffice.org/license.html>
++# for a copy of the LGPLv3 License.
++#
++#*************************************************************************
++
++PRJ=..$/..
++
++PRJNAME=cli_ure
++TARGET=mono_loader
++
++VISIBILITY_HIDDEN=TRUE
++NO_BSYMBOLIC=	TRUE
++ENABLE_EXCEPTIONS=TRUE
++COMP1TYPELIST=$(TARGET)
++COMPRDB=$(SOLARBINDIR)$/types.rdb
++
++# --- Settings -----------------------------------------------------
++
++.INCLUDE :  settings.mk
++CFLAGS+=$(MONO_CFLAGS)
++DLLPRE =
++
++# ------------------------------------------------------------------
++
++#.INCLUDE :  ..$/cppumaker.mk
++
++SLOFILES= \
++		$(SLO)$/service.obj \
++		$(SLO)$/mono_loader.obj
++
++SHL1TARGET= $(TARGET)$(DLLPOSTFIX).uno
++SHL1IMPLIB=     i$(TARGET)
++
++SHL1VERSIONMAP=$(SOLARENV)/src/component.map
++SHL1DEF=$(MISC)$/$(SHL1TARGET).def
++DEF1NAME=$(SHL1TARGET)
++                                                                              
++SHL1STDLIBS= \
++                $(CPPUHELPERLIB) \
++		$(COMPHELPERLIB) \
++                $(CPPULIB) \
++                $(TOOLSLIB) \
++                $(SALLIB)
++
++SHL1STDLIBS+=$(MONO_LIBS)
++                                                                              
++SHL1DEPN=
++SHL1LIBS=$(SLB)$/$(TARGET).lib
++
++# --- Targets ------------------------------------------------------
++
++.INCLUDE :	target.mk
+diff --git cli_ure/source/mono_loader/mono_loader.cxx cli_ure/source/mono_loader/mono_loader.cxx
+new file mode 100644
+index 0000000..ed090cb
+--- /dev/null
++++ cli_ure/source/mono_loader/mono_loader.cxx
+@@ -0,0 +1,255 @@
++/*************************************************************************
++ *
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ * 
++ * Copyright 2008 by Sun Microsystems, Inc.
++ *
++ * OpenOffice.org - a multi-platform office productivity suite
++ *
++ * $RCSfile: eventhelper.cxx,v $
++ * $Revision: 1.0 $
++ *
++ * This file is part of OpenOffice.org.
++ *
++ * OpenOffice.org is free software: you can redistribute it and/or modify
++ * it under the terms of the GNU Lesser General Public License version 3
++ * only, as published by the Free Software Foundation.
++ *
++ * OpenOffice.org is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++ * GNU Lesser General Public License version 3 for more details
++ * (a copy is included in the LICENSE file that accompanied this code).
++ *
++ * You should have received a copy of the GNU Lesser General Public License
++ * version 3 along with OpenOffice.org.  If not, see
++ * <http://www.openoffice.org/license.html>
++ * for a copy of the LGPLv3 License.
++ *
++ ************************************************************************/
++
++// MARKER(update_precomp.py): autogen include statement, do not remove
++#include "precompiled_cli_ure.hxx"
++#include <comphelper/processfactory.hxx>
++#include <comphelper/uno3.hxx>
++#include <com/sun/star/lang/XMultiComponentFactory.hpp>
++#include <com/sun/star/loader/XImplementationLoader.hpp>
++#include <com/sun/star/beans/XPropertySet.hpp>
++#include <com/sun/star/container/XNamed.hpp>
++#include <com/sun/star/lang/XServiceInfo.hpp>
++#include <com/sun/star/lang/XInitialization.hpp>
++#include <com/sun/star/util/XMacroExpander.hpp>
++#include <cppuhelper/implbase2.hxx>
++#include "uno/mapping.hxx"
++
++// for debug
++#include <comphelper/anytostring.hxx>
++
++extern "C" {
++#include <mono/jit/jit.h>
++#include <mono/metadata/object.h>
++#include <mono/metadata/environment.h>
++#include <mono/metadata/assembly.h>
++#include <mono/metadata/debug-helpers.h>
++#include <mono/metadata/threads.h>
++}
++
++using namespace ::com::sun::star;
++#define OUSTR(x) ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(x) )
++
++//static const char CLIURE_DLL[] = "$URE_LIB_DIR/cli_ure.dll";
++static const char CLIURE_DLL[] = "$URE_INTERNAL_LIB_DIR/cli_ure.dll";
++typedef ::cppu::WeakImplHelper2< loader::XImplementationLoader, lang::XServiceInfo > MonoLoader_BASE;
++
++namespace mono_loader
++{
++    ::rtl::OUString SAL_CALL getImplementationName();
++
++    uno::Reference< uno::XInterface > SAL_CALL create( uno::Reference< uno::XComponentContext > const & xContext ) SAL_THROW( () );
++
++    uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames();
++}
++
++uno::Reference< loader::XImplementationLoader >
++create_object (MonoDomain *domain, MonoImage *image)
++{
++	MonoClass *klass;
++
++	klass = mono_class_from_name (image, "uno.util", "ManagedCodeLoader");
++	if (!klass) {
++		OSL_TRACE ("Can't find ManagedCodeLoader in assembly %s", mono_image_get_filename (image));
++		return NULL;
++	}
++	MonoObject* obj = mono_object_new (domain, klass);
++	/* mono_object_new () only allocates the storage: 
++	 * it doesn't run any constructor. Tell the runtime to run
++	 * the default argumentless constructor.
++	 */
++	mono_runtime_object_init (obj);
++        static uno::Reference< loader::XImplementationLoader > xLoader;
++        // not sure if this is correct ( I'm loosely following 'to_uno'
++        // method in cli_ure/source/native/native_share.h ) 
++
++        loader::XImplementationLoader* pLoader = NULL;
++        OSL_TRACE("About to call mapInterface for XImplementionLoader returned from Mono");
++        // we are storing the object so... I guess we need to tell the gc not
++        // to bother about this object
++        //mono_gchandle_new( obj, false ); // where do we release that ? do we even need to do this?
++        guint32 nHandle = mono_gchandle_new( obj, true ); // where do we release that ? do we even need to do this?
++        uno::Mapping mapping( OUSTR( UNO_LB_CLI ), OUSTR( CPPU_CURRENT_LANGUAGE_BINDING_NAME ) );
++        OSL_ASSERT( mapping.is() );
++        if (! mapping.is() )
++            return NULL;
++
++        mapping.mapInterface( 
++            reinterpret_cast< void ** >( &pLoader ), 
++            reinterpret_cast< void * >( obj ), ::getCppuType( &xLoader ) );
++        mono_gchandle_free ( nHandle ); // copying what cli_ure/source/native/native_share.h does for DotNet 
++        xLoader.set( pLoader, SAL_NO_ACQUIRE /* takeover ownership */ );  
++        OSL_TRACE("We appear to have got an XImplementationLoader that has a value? %s", xLoader.is() ? "yes" : "no " );
++        return xLoader;
++}
++
++
++class MonoLoader : public MonoLoader_BASE
++{
++    class MonoCleanUp
++    {
++    public:
++        MonoCleanUp() { OSL_TRACE("MonoCleanUp created "); }
++        ~MonoCleanUp() 
++        { 
++            OSL_TRACE("~MonoCleanUp"); 
++            // loader only uses the root domain
++            mono_jit_cleanup (mono_get_root_domain());
++        }
++    };
++    uno::Reference< uno::XComponentContext > mxContext;
++    uno::Reference< loader::XImplementationLoader > mxLoader;
++    uno::Reference< util::XMacroExpander > mxExpander;
++    uno::Reference< loader::XImplementationLoader > getLoader( const char* file) 
++    {
++        OSL_TRACE("** enter getLoader()");
++        // init only once
++        static MonoDomain* domain = mono_jit_init (file);
++        // when is a good time to trigger clean up ?
++        //static MonoCleanUp cleaner;
++        // hmm appears we need to attach this thread to the domain
++        mono_thread_attach( domain );
++	MonoAssembly *assembly;
++       
++	assembly = mono_domain_assembly_open ( domain, file);
++        OSL_TRACE("** open of assembly %s = 0x%x", file, assembly);
++        if ( !assembly )
++            throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Failed to open assembly " ) ) + rtl::OUString::createFromAscii( file ), NULL );
++        return create_object (domain, mono_assembly_get_image (assembly));         
++    }
++
++
++public:
++    MonoLoader( const uno::Reference< uno::XComponentContext >& rxContext ) : mxContext( rxContext )
++    {
++        if (!(mxContext->getValueByName( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/singletons/com.sun.star.util.theMacroExpander"))) >>= mxExpander)
++        || !mxExpander.is())
++        {
++            throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "component context fails to supply singleton" " com.sun.star.util.theMacroExpander of type" " com.sun.star.util.XMacroExpander")), mxContext);        
++        }
++        rtl::OUString dllPath =  mxExpander->expandMacros( rtl::OUString(  RTL_CONSTASCII_USTRINGPARAM( CLIURE_DLL ) ) );
++        OSL_TRACE("**** location for dll is %s", rtl::OUStringToOString( dllPath, RTL_TEXTENCODING_UTF8 ).getStr() );
++        OSL_TRACE("** MonoLoader::MonoLoader() ");
++        mxLoader = getLoader( rtl::OUStringToOString( dllPath, RTL_TEXTENCODING_UTF8 ).getStr() );
++        if ( mxLoader.is() )
++        {
++            // set the service factory
++            uno::Sequence< uno::Any > args(1);
++            args[ 0 ] <<= rxContext->getServiceManager();
++            uno::Reference< lang::XInitialization > xInitialize( mxLoader, uno::UNO_QUERY_THROW );
++            OSL_TRACE("MonoLoader::MonoLoader() about to call initialise");
++            xInitialize->initialize( args );
++        }
++        else 
++            OSL_TRACE("**  MonoLoader::MonoLoader(): No Mono loader found ");
++
++    }
++    ~MonoLoader()
++    {
++        OSL_TRACE("** MonoLoader::~MonoLoader() ");
++    }
++    // Methods
++    virtual uno::Reference< uno::XInterface > SAL_CALL activate( const ::rtl::OUString& implementationName, const ::rtl::OUString& implementationLoaderUrl, const ::rtl::OUString& locationUrl, const uno::Reference< registry::XRegistryKey >& xKey ) throw (loader::CannotActivateFactoryException, uno::RuntimeException)
++    {
++        // try to instatiate a mono loader and return a reference to it
++        OSL_TRACE("**** in MonoLoader::activate");
++        if ( mxLoader.is() )
++        {
++            OSL_TRACE("*** MonoLoader::activate() about to call activate on 0x%x", mxLoader.get() );
++            return mxLoader->activate( implementationName, implementationLoaderUrl, locationUrl, xKey );
++        }
++        return NULL;
++    }
++
++    virtual ::sal_Bool SAL_CALL writeRegistryInfo( const uno::Reference< registry::XRegistryKey >& xKey, const ::rtl::OUString& implementationLoaderUrl, const ::rtl::OUString& locationUrl ) throw (registry::CannotRegisterImplementationException, uno::RuntimeException)
++    { 
++        if ( mxLoader.is() )
++            return mxLoader->writeRegistryInfo( xKey, implementationLoaderUrl, locationUrl );
++        return sal_False;
++    }
++    virtual ::rtl::OUString SAL_CALL getImplementationName(  ) throw (uno::RuntimeException){ return mono_loader::getImplementationName(); }
++    virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (uno::RuntimeException)
++    {
++        sal_Bool bRes = sal_False;
++        uno::Sequence< ::rtl::OUString > sServices = mono_loader::getSupportedServiceNames();
++        const ::rtl::OUString* pService = sServices.getConstArray();
++        const ::rtl::OUString* pEnd = sServices.getConstArray() + sServices.getLength();
++        for ( ; pService != pEnd ;  ++pService )
++        {
++            if ( (*pService).equals( ServiceName ) )
++            {
++                bRes = sal_True;
++                break;
++            }
++        }
++        return bRes;
++    }
++    virtual uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames(  ) throw (uno::RuntimeException){ return mono_loader::getSupportedServiceNames(); }
++
++};
++
++namespace mono_loader
++{
++    ::rtl::OUString SAL_CALL getImplementationName()
++    {
++        static ::rtl::OUString* pImplName = 0;
++        if ( !pImplName )
++        {
++            ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
++            if ( !pImplName )
++            {
++                static ::rtl::OUString aImplName( RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.loader.MonoLoader" ) );
++                pImplName = &aImplName;
++            }
++        }
++        return *pImplName;
++    }
++
++    uno::Reference< uno::XInterface > SAL_CALL create(
++    uno::Reference< uno::XComponentContext > const & xContext )
++    SAL_THROW( () )
++    {
++        OSL_TRACE("** In create for monoloader");
++        // mimic java loader if I read it correctly it just has a single entry 
++        // point ( Mono implementation loader should do the same? #TODO maybe )
++        // #FIXME use whatever boiler plate static initialisatioon foo that is 
++        // available ( seem to recall there is some helpers for that )
++        // static uno::Reference < lang::XTypeProvider  > xLoader( new MonoLoader( xContext ) );
++        // hmm lets not do it for now  
++        uno::Reference < lang::XTypeProvider  > xLoader( new MonoLoader( xContext ) );
++        return xLoader;
++    }
++
++    uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
++    {
++        const ::rtl::OUString strName( ::mono_loader::getImplementationName() );
++        return uno::Sequence< ::rtl::OUString >( &strName, 1 );
++    }	
++}
+diff --git cli_ure/source/mono_loader/mono_loader.xml cli_ure/source/mono_loader/mono_loader.xml
+new file mode 100644
+index 0000000..06e6c73
+--- /dev/null
++++ cli_ure/source/mono_loader/mono_loader.xml
+@@ -0,0 +1,26 @@
++<?xml version="1.0" encoding="UTF-8"?>
++<!DOCTYPE module-description PUBLIC "-//StarOffice//DTD ComponentDescription 1.0//EN" "module-description.dtd">
++<module-description xmlns:xlink="http://www.w3.org/1999/xlink">
++
++    <module-name>mono_loader</module-name>
++    
++    <component-description>
++        <author>Noel Power </author>
++        <name>Mono Loader</name>
++        <description>Loader for components located in mono assemblies</description>
++        <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
++        <language>c++</language>
++        <status value="drafts"/>
++        <supported-service>org.openoffice.loader.MonoLoader</supported-service>
++        <type>com.sun.star.uno.XComponentContext</type>        
++    </component-description>
++    
++    <project-build-dependency>cppuhelper</project-build-dependency>
++    <project-build-dependency>cppu</project-build-dependency>
++    <project-build-dependency>sal</project-build-dependency>
++
++    <runtime-module-dependency>cppuhelper3$(COM)</runtime-module-dependency>
++    <runtime-module-dependency>cppu3</runtime-module-dependency>
++    <runtime-module-dependency>sal3</runtime-module-dependency>
++    
++</module-description>
+diff --git cli_ure/source/mono_loader/service.cxx cli_ure/source/mono_loader/service.cxx
+new file mode 100644
+index 0000000..39eed95
+--- /dev/null
++++ cli_ure/source/mono_loader/service.cxx
+@@ -0,0 +1,133 @@
++/*************************************************************************
++ *
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ * 
++ * Copyright 2008 by Sun Microsystems, Inc.
++ *
++ * OpenOffice.org - a multi-platform office productivity suite
++ *
++ * $RCSfile: service.cxx,v $
++ * $Revision: 1.0 $
++ *
++ * This file is part of OpenOffice.org.
++ *
++ * OpenOffice.org is free software: you can redistribute it and/or modify
++ * it under the terms of the GNU Lesser General Public License version 3
++ * only, as published by the Free Software Foundation.
++ *
++ * OpenOffice.org is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++ * GNU Lesser General Public License version 3 for more details
++ * (a copy is included in the LICENSE file that accompanied this code).
++ *
++ * You should have received a copy of the GNU Lesser General Public License
++ * version 3 along with OpenOffice.org.  If not, see
++ * <http://www.openoffice.org/license.html>
++ * for a copy of the LGPLv3 License.
++ *
++ ************************************************************************/
++
++// MARKER(update_precomp.py): autogen include statement, do not remove
++#include "precompiled_cli_ure.hxx"
++#include "cppuhelper/implementationentry.hxx"
++#include "com/sun/star/lang/XMultiServiceFactory.hpp"
++#include "com/sun/star/registry/XRegistryKey.hpp"
++
++// =============================================================================
++// component exports
++// =============================================================================
++using namespace ::com::sun::star;
++using namespace ::com::sun::star::uno;
++
++namespace mono_loader
++{
++    // =============================================================================
++    // component operations
++    // =============================================================================
++
++    uno::Reference< XInterface > SAL_CALL create(
++        Reference< XComponentContext > const & xContext )
++        SAL_THROW( () );
++
++    // -----------------------------------------------------------------------------
++
++    ::rtl::OUString SAL_CALL getImplementationName();
++
++    Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames();
++
++    Reference<XInterface> SAL_CALL create(
++        Sequence<Any> const &, Reference<XComponentContext> const & );
++} // end mono_loader
++
++namespace mono_testcomponent
++{
++    // =============================================================================
++    // component operations
++    // =============================================================================
++
++    uno::Reference< XInterface > SAL_CALL create(
++        Reference< XComponentContext > const & xContext )
++        SAL_THROW( () );
++
++    // -----------------------------------------------------------------------------
++
++    ::rtl::OUString SAL_CALL getImplementationName();
++
++    Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames();
++
++    Reference<XInterface> SAL_CALL create(
++        Sequence<Any> const &, Reference<XComponentContext> const & );
++} // end mono_testcomponent
++
++
++
++    // =============================================================================
++
++    const ::cppu::ImplementationEntry s_component_entries [] =
++    {
++        {
++            ::mono_loader::create, ::mono_loader::getImplementationName,
++            ::mono_loader::getSupportedServiceNames, 
++            ::cppu::createSingleComponentFactory,
++            0, 0
++        },
++/*
++        {
++            ::mono_testcomponent::create, ::mono_testcomponent::getImplementationName,
++            ::mono_testcomponent::getSupportedServiceNames, 
++            ::cppu::createSingleComponentFactory,
++            0, 0
++        },
++*/
++        { 0, 0, 0, 0, 0, 0 }
++    };
++
++extern "C"
++{
++    SAL_DLLPUBLIC_EXPORT  void SAL_CALL component_getImplementationEnvironment( 
++        const sal_Char ** ppEnvTypeName, uno_Environment ** )
++    {
++        OSL_TRACE("In component_getImplementationEnv");
++        *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
++    }
++
++    SAL_DLLPUBLIC_EXPORT  sal_Bool SAL_CALL component_writeInfo( 
++        lang::XMultiServiceFactory * pServiceManager, registry::XRegistryKey * pRegistryKey )
++    {
++        OSL_TRACE("In component_writeInfo");
++        if ( ::cppu::component_writeInfoHelper(
++            pServiceManager, pRegistryKey, s_component_entries ) )
++            return sal_True;
++        return sal_False;
++    }
++
++    SAL_DLLPUBLIC_EXPORT  void * SAL_CALL component_getFactory( 
++        const sal_Char * pImplName, lang::XMultiServiceFactory * pServiceManager,
++        registry::XRegistryKey * pRegistryKey )
++    {
++        OSL_TRACE("In component_getFactory");
++        return ::cppu::component_getFactoryHelper( 
++            pImplName, pServiceManager, pRegistryKey, s_component_entries );
++    }
++}
+diff --git scp2/source/ooo/ure.scp scp2/source/ooo/ure.scp
+index 39acafe..194ec13 100755
+--- scp2/source/ooo/ure.scp
++++ scp2/source/ooo/ure.scp
+@@ -421,6 +421,16 @@ File gid_File_Dl_LogUnoUno
+     Styles = (PACKED, VERSION_INDEPENDENT_COMP_ID);
+ End
+ 
++#ifdef UNX // currently we only will build this on unix
++File gid_File_Dl_MonoLoader
++    TXT_FILE_BODY;
++    Dir = SCP2_URE_DL_DIR;
++    Name = STRING(CONCAT4(mono_loader,DLLPOSTFIX,.uno,UNXSUFFIX));
++    Styles = (PACKED, UNO_COMPONENT, VERSION_INDEPENDENT_COMP_ID);
++    RegistryID = gid_Starregistry_Services_Rdb_Ure;
++End
++#endif
++
+ #if (defined WNT && defined _MSC) || defined ENABLE_MONO
+ File gid_File_Dl_Cli_Uno
+     TXT_FILE_BODY;
+diff --git cli_ure/prj/build.lst cli_ure/prj/build.lst
+index 1c21fd5..6b65166 100644
+--- cli_ure/prj/build.lst
++++ cli_ure/prj/build.lst
+@@ -10,5 +10,6 @@ ure	cli_ure\unotypes				nmake   -       all     ure_unotypes ure_source_version
+ ure	cli_ure\source\ure                      nmake   -       all     ure_source_ure ure_source_bootstrap.u ure_source_version ure_source_source ure_source_basetypes ure_unotypes ure_inc NULL
+ ure	cli_ure\source\uno_bridge		nmake	-		w,vc7	ure_source_uno_bridge ure_source_basetypes ure_unotypes ure_source_ure ure_inc NULL
+ ure	cli_ure\source\mono_bridge      nmake   -       u       ure_source_mono_bridge ure_unotypes ure_source_ure ure_inc NULL
++ure	cli_ure\source\mono_loader      nmake   -       u       ure_source_mono_loader ure_unotypes ure_source_ure ure_inc NULL
+ ure	cli_ure\source\native           nmake   -       w,vc7   ure_source_native ure_source_version ure_source_source ure_source_ure ure_unotypes ure_source_uno_bridge ure_inc NULL
+ #ure	cli_ure\util                    nmake   -       w,vc7   ure_util ure_source_ure ure_source_native NULL
+diff --git cli_ure/prj/d.lst cli_ure/prj/d.lst
+index 53cc64a..237c21e 100644
+--- cli_ure/prj/d.lst
++++ cli_ure/prj/d.lst
+@@ -9,6 +9,7 @@
+ ..\%__SRC%\bin\cli_*.config %_DEST%\bin%_EXT%\cli_*.config
+ ..\%__SRC%\bin\policy*.dll %_DEST%\bin%_EXT%\policy*.dll
+ ..\%__SRC%\bin\cli_uno.* %_DEST%\bin%_EXT%\cli_uno.*
++..\%__SRC%\lib\mono_loader*.so %_DEST%\lib%_EXT%\mono_loader*.so
+ 
+ ..\%__SRC%\bin\cliuno.snk %_DEST%\bin%_EXT%\cliuno.snk
+ 


More information about the ooo-build-commit mailing list