1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
29*cdf0e10cSrcweir #include "precompiled_cli_ure.hxx"
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir #include <vcclr.h>
32*cdf0e10cSrcweir //ToDo: remove when build with .NET 2
33*cdf0e10cSrcweir #pragma warning(push, 1)
34*cdf0e10cSrcweir #include <windows.h>
35*cdf0e10cSrcweir #include "uno/environment.hxx"
36*cdf0e10cSrcweir #pragma warning(pop)
37*cdf0e10cSrcweir #include "rtl/unload.h"
38*cdf0e10cSrcweir #include "uno/lbnames.h"
39*cdf0e10cSrcweir #include "uno/mapping.hxx"
40*cdf0e10cSrcweir #include "typelib/typedescription.hxx"
41*cdf0e10cSrcweir #include "rtl/ustring.hxx"
42*cdf0e10cSrcweir 
43*cdf0e10cSrcweir #include "cli_bridge.h"
44*cdf0e10cSrcweir #include "cli_proxy.h"
45*cdf0e10cSrcweir namespace srr= System::Runtime::Remoting;
46*cdf0e10cSrcweir namespace srrp= System::Runtime::Remoting::Proxies;
47*cdf0e10cSrcweir #using <mscorlib.dll>
48*cdf0e10cSrcweir #if defined(_MSC_VER) && (_MSC_VER < 1400)
49*cdf0e10cSrcweir #include <_vcclrit.h>
50*cdf0e10cSrcweir #endif
51*cdf0e10cSrcweir 
52*cdf0e10cSrcweir namespace  cssu= com::sun::star::uno;
53*cdf0e10cSrcweir 
54*cdf0e10cSrcweir 
55*cdf0e10cSrcweir namespace sri= System::Runtime::InteropServices;
56*cdf0e10cSrcweir using namespace rtl;
57*cdf0e10cSrcweir 
58*cdf0e10cSrcweir namespace cli_uno
59*cdf0e10cSrcweir {
60*cdf0e10cSrcweir 
61*cdf0e10cSrcweir extern "C"
62*cdf0e10cSrcweir {
63*cdf0e10cSrcweir void SAL_CALL Mapping_acquire( uno_Mapping * mapping )
64*cdf0e10cSrcweir     SAL_THROW_EXTERN_C()
65*cdf0e10cSrcweir {
66*cdf0e10cSrcweir     Mapping const * that = static_cast< Mapping const * >( mapping );
67*cdf0e10cSrcweir      that->m_bridge->acquire();
68*cdf0e10cSrcweir }
69*cdf0e10cSrcweir //--------------------------------------------------------------------------------------------------
70*cdf0e10cSrcweir void SAL_CALL Mapping_release( uno_Mapping * mapping )
71*cdf0e10cSrcweir     SAL_THROW_EXTERN_C()
72*cdf0e10cSrcweir {
73*cdf0e10cSrcweir     Mapping const * that = static_cast< Mapping const * >( mapping );
74*cdf0e10cSrcweir     that->m_bridge->release();
75*cdf0e10cSrcweir }
76*cdf0e10cSrcweir 
77*cdf0e10cSrcweir 
78*cdf0e10cSrcweir //--------------------------------------------------------------------------------------------------
79*cdf0e10cSrcweir void SAL_CALL Mapping_cli2uno(
80*cdf0e10cSrcweir     uno_Mapping * mapping, void ** ppOut,
81*cdf0e10cSrcweir     void * pIn, typelib_InterfaceTypeDescription * td )
82*cdf0e10cSrcweir     SAL_THROW_EXTERN_C()
83*cdf0e10cSrcweir {
84*cdf0e10cSrcweir     uno_Interface ** ppUnoI = (uno_Interface **)ppOut;
85*cdf0e10cSrcweir     intptr_t  cliI = (intptr_t)pIn;
86*cdf0e10cSrcweir 
87*cdf0e10cSrcweir     OSL_ENSURE( ppUnoI && td, "### null ptr!" );
88*cdf0e10cSrcweir 
89*cdf0e10cSrcweir  	if (0 != *ppUnoI)
90*cdf0e10cSrcweir  	{
91*cdf0e10cSrcweir          uno_Interface * pUnoI = *(uno_Interface **)ppUnoI;
92*cdf0e10cSrcweir  		(*pUnoI->release)( pUnoI );
93*cdf0e10cSrcweir  		*ppUnoI = 0;
94*cdf0e10cSrcweir  	}
95*cdf0e10cSrcweir     try
96*cdf0e10cSrcweir     {
97*cdf0e10cSrcweir         Mapping const * that = static_cast< Mapping const * >( mapping );
98*cdf0e10cSrcweir         Bridge * bridge = that->m_bridge;
99*cdf0e10cSrcweir 
100*cdf0e10cSrcweir         if (0 != cliI)
101*cdf0e10cSrcweir         {
102*cdf0e10cSrcweir             System::Object* cliObj= sri::GCHandle::op_Explicit(cliI).Target;
103*cdf0e10cSrcweir             (*ppOut)= bridge->map_cli2uno(cliObj, (typelib_TypeDescription*) td);
104*cdf0e10cSrcweir         }
105*cdf0e10cSrcweir     }
106*cdf0e10cSrcweir     catch (BridgeRuntimeError & err)
107*cdf0e10cSrcweir     {
108*cdf0e10cSrcweir #if OSL_DEBUG_LEVEL >= 1
109*cdf0e10cSrcweir         OString cstr_msg(
110*cdf0e10cSrcweir             OUStringToOString(
111*cdf0e10cSrcweir                 OUSTR("[cli_uno bridge error] ") + err.m_message, RTL_TEXTENCODING_ASCII_US ) );
112*cdf0e10cSrcweir         OSL_ENSURE( 0, cstr_msg.getStr() );
113*cdf0e10cSrcweir #else
114*cdf0e10cSrcweir         (void) err; // unused
115*cdf0e10cSrcweir #endif
116*cdf0e10cSrcweir     }
117*cdf0e10cSrcweir }
118*cdf0e10cSrcweir //--------------------------------------------------------------------------------------------------
119*cdf0e10cSrcweir void SAL_CALL Mapping_uno2cli(
120*cdf0e10cSrcweir     uno_Mapping * mapping, void ** ppOut,
121*cdf0e10cSrcweir     void * pIn, typelib_InterfaceTypeDescription * td )
122*cdf0e10cSrcweir     SAL_THROW_EXTERN_C()
123*cdf0e10cSrcweir {
124*cdf0e10cSrcweir     try
125*cdf0e10cSrcweir     {
126*cdf0e10cSrcweir         OSL_ENSURE( td && ppOut, "### null ptr!" );
127*cdf0e10cSrcweir         OSL_ENSURE( (sizeof(System::Char) == sizeof(sal_Unicode))
128*cdf0e10cSrcweir                     && (sizeof(System::Boolean) == sizeof(sal_Bool))
129*cdf0e10cSrcweir                     && (sizeof(System::SByte) == sizeof(sal_Int8))
130*cdf0e10cSrcweir                     && (sizeof(System::Int16) == sizeof(sal_Int16))
131*cdf0e10cSrcweir                     && (sizeof(System::UInt16) == sizeof(sal_uInt16))
132*cdf0e10cSrcweir                     && (sizeof(System::Int32) == sizeof(sal_Int32))
133*cdf0e10cSrcweir                     && (sizeof(System::UInt32) == sizeof(sal_uInt32))
134*cdf0e10cSrcweir                     && (sizeof(System::Int64) == sizeof(sal_Int64))
135*cdf0e10cSrcweir                     && (sizeof(System::UInt64) == sizeof(sal_uInt64))
136*cdf0e10cSrcweir                     && (sizeof(System::Single) == sizeof(float))
137*cdf0e10cSrcweir                     && (sizeof(System::Double) == sizeof(double)),
138*cdf0e10cSrcweir                     "[cli_uno bridge] incompatible .NET data types");
139*cdf0e10cSrcweir         intptr_t * ppDNetI = (intptr_t *)ppOut;
140*cdf0e10cSrcweir         uno_Interface * pUnoI = (uno_Interface *)pIn;
141*cdf0e10cSrcweir 
142*cdf0e10cSrcweir         Mapping const * that = static_cast< Mapping const * >( mapping );
143*cdf0e10cSrcweir         Bridge  * bridge = that->m_bridge;
144*cdf0e10cSrcweir 
145*cdf0e10cSrcweir         if (0 != *ppDNetI)
146*cdf0e10cSrcweir         {
147*cdf0e10cSrcweir             sri::GCHandle::op_Explicit(ppDNetI).Free();
148*cdf0e10cSrcweir         }
149*cdf0e10cSrcweir 
150*cdf0e10cSrcweir         if (0 != pUnoI)
151*cdf0e10cSrcweir         {
152*cdf0e10cSrcweir             System::Object* cliI=  bridge->map_uno2cli(pUnoI, td);
153*cdf0e10cSrcweir             intptr_t ptr= NULL;
154*cdf0e10cSrcweir             if(cliI)
155*cdf0e10cSrcweir             {
156*cdf0e10cSrcweir                 ptr= sri::GCHandle::op_Explicit(sri::GCHandle::Alloc(cliI))
157*cdf0e10cSrcweir #ifdef _WIN32
158*cdf0e10cSrcweir                     .ToInt32();
159*cdf0e10cSrcweir #else /* defined(_WIN64) */                 .ToInt64();
160*cdf0e10cSrcweir #endif
161*cdf0e10cSrcweir             }
162*cdf0e10cSrcweir             (*ppOut)= reinterpret_cast<void*>(ptr);
163*cdf0e10cSrcweir         }
164*cdf0e10cSrcweir     }
165*cdf0e10cSrcweir     catch (BridgeRuntimeError & err)
166*cdf0e10cSrcweir     {
167*cdf0e10cSrcweir #if OSL_DEBUG_LEVEL >= 1
168*cdf0e10cSrcweir         rtl::OString cstr_msg(
169*cdf0e10cSrcweir             rtl::OUStringToOString(
170*cdf0e10cSrcweir                 OUSTR("[cli_uno bridge error] ") + err.m_message, RTL_TEXTENCODING_ASCII_US ) );
171*cdf0e10cSrcweir         OSL_ENSURE( 0, cstr_msg.getStr() );
172*cdf0e10cSrcweir #else
173*cdf0e10cSrcweir         (void) err; // unused
174*cdf0e10cSrcweir #endif
175*cdf0e10cSrcweir     }
176*cdf0e10cSrcweir }
177*cdf0e10cSrcweir 
178*cdf0e10cSrcweir //__________________________________________________________________________________________________
179*cdf0e10cSrcweir void SAL_CALL Bridge_free( uno_Mapping * mapping )
180*cdf0e10cSrcweir     SAL_THROW_EXTERN_C()
181*cdf0e10cSrcweir {
182*cdf0e10cSrcweir     Mapping * that = static_cast< Mapping * >( mapping );
183*cdf0e10cSrcweir     delete that->m_bridge;
184*cdf0e10cSrcweir }
185*cdf0e10cSrcweir 
186*cdf0e10cSrcweir } //extern C
187*cdf0e10cSrcweir } //namespace
188*cdf0e10cSrcweir 
189*cdf0e10cSrcweir namespace cli_uno
190*cdf0e10cSrcweir {
191*cdf0e10cSrcweir 
192*cdf0e10cSrcweir //__________________________________________________________________________________________________
193*cdf0e10cSrcweir /** ToDo
194*cdf0e10cSrcweir     I doubt that the the case that the ref count raises from 0 to 1
195*cdf0e10cSrcweir     can occur.  uno_ext_getMapping returns an acquired mapping. Every time
196*cdf0e10cSrcweir     that function is called then a new mapping is created. Following the
197*cdf0e10cSrcweir     rules of ref counted objects, then if the ref count is null noone has
198*cdf0e10cSrcweir     a reference to the object anymore. Hence noone can call acquire. If someone
199*cdf0e10cSrcweir     calls acquire then they must have kept an unacquired pointer which is
200*cdf0e10cSrcweir     illegal.
201*cdf0e10cSrcweir  */
202*cdf0e10cSrcweir void Bridge::acquire()  const SAL_THROW( () )
203*cdf0e10cSrcweir {
204*cdf0e10cSrcweir     if (1 == osl_incrementInterlockedCount( &m_ref ))
205*cdf0e10cSrcweir     {
206*cdf0e10cSrcweir         if (m_registered_cli2uno)
207*cdf0e10cSrcweir         {
208*cdf0e10cSrcweir             uno_Mapping * mapping = const_cast<Mapping*>(&m_cli2uno);
209*cdf0e10cSrcweir             uno_registerMapping(
210*cdf0e10cSrcweir                 & const_cast<uno_Mapping*>(mapping), Bridge_free, m_uno_cli_env, (uno_Environment *)m_uno_env, 0 );
211*cdf0e10cSrcweir         }
212*cdf0e10cSrcweir         else
213*cdf0e10cSrcweir         {
214*cdf0e10cSrcweir             uno_Mapping * mapping = const_cast<Mapping*>(&m_uno2cli);
215*cdf0e10cSrcweir             uno_registerMapping(
216*cdf0e10cSrcweir                 &mapping, Bridge_free, (uno_Environment *)m_uno_env, m_uno_cli_env, 0 );
217*cdf0e10cSrcweir         }
218*cdf0e10cSrcweir     }
219*cdf0e10cSrcweir }
220*cdf0e10cSrcweir //__________________________________________________________________________________________________
221*cdf0e10cSrcweir void Bridge::release() const  SAL_THROW( () )
222*cdf0e10cSrcweir {
223*cdf0e10cSrcweir     if (! osl_decrementInterlockedCount( &m_ref ))
224*cdf0e10cSrcweir     {
225*cdf0e10cSrcweir         uno_revokeMapping(
226*cdf0e10cSrcweir             m_registered_cli2uno
227*cdf0e10cSrcweir             ?  const_cast<Mapping*>(&m_cli2uno)
228*cdf0e10cSrcweir             :  const_cast<Mapping*>(&m_uno2cli)  );
229*cdf0e10cSrcweir    }
230*cdf0e10cSrcweir }
231*cdf0e10cSrcweir //__________________________________________________________________________________________________
232*cdf0e10cSrcweir Bridge::Bridge(
233*cdf0e10cSrcweir     uno_Environment * uno_cli_env, uno_ExtEnvironment * uno_env,
234*cdf0e10cSrcweir     bool registered_cli2uno )
235*cdf0e10cSrcweir     : m_ref( 1 ),
236*cdf0e10cSrcweir       m_uno_env( uno_env ),
237*cdf0e10cSrcweir       m_uno_cli_env( uno_cli_env ),
238*cdf0e10cSrcweir       m_registered_cli2uno( registered_cli2uno )
239*cdf0e10cSrcweir {
240*cdf0e10cSrcweir     OSL_ASSERT( 0 != m_uno_cli_env && 0 != m_uno_env );
241*cdf0e10cSrcweir     (*((uno_Environment *)m_uno_env)->acquire)( (uno_Environment *)m_uno_env );
242*cdf0e10cSrcweir     (*m_uno_cli_env->acquire)( m_uno_cli_env );
243*cdf0e10cSrcweir 
244*cdf0e10cSrcweir     // cli2uno
245*cdf0e10cSrcweir     m_cli2uno.acquire = Mapping_acquire;
246*cdf0e10cSrcweir     m_cli2uno.release = Mapping_release;
247*cdf0e10cSrcweir     m_cli2uno.mapInterface = Mapping_cli2uno;
248*cdf0e10cSrcweir     m_cli2uno.m_bridge = this;
249*cdf0e10cSrcweir     // uno2cli
250*cdf0e10cSrcweir     m_uno2cli.acquire = Mapping_acquire;
251*cdf0e10cSrcweir     m_uno2cli.release = Mapping_release;
252*cdf0e10cSrcweir     m_uno2cli.mapInterface = Mapping_uno2cli;
253*cdf0e10cSrcweir     m_uno2cli.m_bridge = this;
254*cdf0e10cSrcweir 
255*cdf0e10cSrcweir }
256*cdf0e10cSrcweir 
257*cdf0e10cSrcweir //__________________________________________________________________________________________________
258*cdf0e10cSrcweir Bridge::~Bridge() SAL_THROW( () )
259*cdf0e10cSrcweir {
260*cdf0e10cSrcweir     //System::GC::Collect();
261*cdf0e10cSrcweir     (*m_uno_cli_env->release)( m_uno_cli_env );
262*cdf0e10cSrcweir     (*((uno_Environment *)m_uno_env)->release)( (uno_Environment *)m_uno_env );
263*cdf0e10cSrcweir }
264*cdf0e10cSrcweir 
265*cdf0e10cSrcweir 
266*cdf0e10cSrcweir 
267*cdf0e10cSrcweir } //namespace cli_uno
268*cdf0e10cSrcweir 
269*cdf0e10cSrcweir extern "C"
270*cdf0e10cSrcweir {
271*cdf0e10cSrcweir 
272*cdf0e10cSrcweir namespace cli_uno
273*cdf0e10cSrcweir {
274*cdf0e10cSrcweir //--------------------------------------------------------------------------------------------------
275*cdf0e10cSrcweir void SAL_CALL cli_env_disposing( uno_Environment * uno_cli_env )
276*cdf0e10cSrcweir     SAL_THROW_EXTERN_C()
277*cdf0e10cSrcweir {
278*cdf0e10cSrcweir     uno_cli_env->pContext = 0;
279*cdf0e10cSrcweir }
280*cdf0e10cSrcweir 
281*cdf0e10cSrcweir //##################################################################################################
282*cdf0e10cSrcweir void SAL_CALL uno_initEnvironment( uno_Environment * uno_cli_env )
283*cdf0e10cSrcweir     SAL_THROW_EXTERN_C()
284*cdf0e10cSrcweir {
285*cdf0e10cSrcweir 	//ToDo: remove when compiled with .NET 2
286*cdf0e10cSrcweir #if defined(_MSC_VER) && (_MSC_VER < 1400)
287*cdf0e10cSrcweir 	__crt_dll_initialize();
288*cdf0e10cSrcweir #endif
289*cdf0e10cSrcweir 
290*cdf0e10cSrcweir     uno_cli_env->environmentDisposing= cli_env_disposing;
291*cdf0e10cSrcweir 	uno_cli_env->pExtEnv = 0;
292*cdf0e10cSrcweir     //Set the console to print Trace messages
293*cdf0e10cSrcweir #if OSL_DEBUG_LEVEL >= 1
294*cdf0e10cSrcweir     System::Diagnostics::Trace::get_Listeners()->
295*cdf0e10cSrcweir             Add( new System::Diagnostics::TextWriterTraceListener(System::Console::get_Out()));
296*cdf0e10cSrcweir #endif
297*cdf0e10cSrcweir     OSL_ASSERT( 0 == uno_cli_env->pContext );
298*cdf0e10cSrcweir 
299*cdf0e10cSrcweir     // We let the Cli_environment leak, since there is no good point where we could destruct it.
300*cdf0e10cSrcweir     //dispose is not used because we would have then also synchronize the calls to proxies. If the
301*cdf0e10cSrcweir     //Cli_environment is disposed, we must prevent all calls, otherwise we may crash at points
302*cdf0e10cSrcweir     //where g_cli_env is accessed.
303*cdf0e10cSrcweir     //When we compile the bridge with .NET 2 then we can again hold g_cli_env as a static gcroot
304*cdf0e10cSrcweir     //member in a unmanaged class, such as Bridge.
305*cdf0e10cSrcweir 	CliEnvHolder::g_cli_env = new Cli_environment();
306*cdf0e10cSrcweir }
307*cdf0e10cSrcweir //##################################################################################################
308*cdf0e10cSrcweir void SAL_CALL uno_ext_getMapping(
309*cdf0e10cSrcweir     uno_Mapping ** ppMapping, uno_Environment * pFrom, uno_Environment * pTo )
310*cdf0e10cSrcweir     SAL_THROW_EXTERN_C()
311*cdf0e10cSrcweir {
312*cdf0e10cSrcweir     OSL_ASSERT( 0 != ppMapping && 0 != pFrom && 0 != pTo );
313*cdf0e10cSrcweir     if (*ppMapping)
314*cdf0e10cSrcweir     {
315*cdf0e10cSrcweir         (*(*ppMapping)->release)( *ppMapping );
316*cdf0e10cSrcweir         *ppMapping = 0;
317*cdf0e10cSrcweir     }
318*cdf0e10cSrcweir 
319*cdf0e10cSrcweir 
320*cdf0e10cSrcweir     OUString const & from_env_typename = *reinterpret_cast< OUString const * >(
321*cdf0e10cSrcweir         &pFrom->pTypeName );
322*cdf0e10cSrcweir     OUString const & to_env_typename = *reinterpret_cast< OUString const * >(
323*cdf0e10cSrcweir         &pTo->pTypeName );
324*cdf0e10cSrcweir 
325*cdf0e10cSrcweir     uno_Mapping * mapping = 0;
326*cdf0e10cSrcweir 
327*cdf0e10cSrcweir     try
328*cdf0e10cSrcweir     {
329*cdf0e10cSrcweir         if (from_env_typename.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(UNO_LB_CLI) ) &&
330*cdf0e10cSrcweir             to_env_typename.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(UNO_LB_UNO) ))
331*cdf0e10cSrcweir         {
332*cdf0e10cSrcweir             Bridge * bridge = new Bridge( pFrom, pTo->pExtEnv, true ); // ref count = 1
333*cdf0e10cSrcweir             mapping = &bridge->m_cli2uno;
334*cdf0e10cSrcweir             uno_registerMapping(
335*cdf0e10cSrcweir                 &mapping, Bridge_free, pFrom, (uno_Environment *)pTo->pExtEnv, 0 );
336*cdf0e10cSrcweir         }
337*cdf0e10cSrcweir         else if (from_env_typename.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(UNO_LB_UNO) ) &&
338*cdf0e10cSrcweir                  to_env_typename.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(UNO_LB_CLI) ))
339*cdf0e10cSrcweir         {
340*cdf0e10cSrcweir             Bridge * bridge = new Bridge( pTo, pFrom->pExtEnv, false ); // ref count = 1
341*cdf0e10cSrcweir             mapping = &bridge->m_uno2cli;
342*cdf0e10cSrcweir             uno_registerMapping(
343*cdf0e10cSrcweir                 &mapping, Bridge_free, (uno_Environment *)pFrom->pExtEnv, pTo, 0 );
344*cdf0e10cSrcweir         }
345*cdf0e10cSrcweir     }
346*cdf0e10cSrcweir     catch (BridgeRuntimeError & err)
347*cdf0e10cSrcweir     {
348*cdf0e10cSrcweir #if OSL_DEBUG_LEVEL >= 1
349*cdf0e10cSrcweir         OString cstr_msg(
350*cdf0e10cSrcweir             OUStringToOString(
351*cdf0e10cSrcweir                 OUSTR("[cli_uno bridge error] ") + err.m_message, RTL_TEXTENCODING_ASCII_US ) );
352*cdf0e10cSrcweir         OSL_ENSURE( 0, cstr_msg.getStr() );
353*cdf0e10cSrcweir #else
354*cdf0e10cSrcweir         (void) err; // unused
355*cdf0e10cSrcweir #endif
356*cdf0e10cSrcweir     }
357*cdf0e10cSrcweir     *ppMapping = mapping;
358*cdf0e10cSrcweir }
359*cdf0e10cSrcweir 
360*cdf0e10cSrcweir 
361*cdf0e10cSrcweir //##################################################################################################
362*cdf0e10cSrcweir sal_Bool SAL_CALL component_canUnload( TimeValue * )
363*cdf0e10cSrcweir     SAL_THROW_EXTERN_C()
364*cdf0e10cSrcweir {
365*cdf0e10cSrcweir     return true;
366*cdf0e10cSrcweir }
367*cdf0e10cSrcweir 
368*cdf0e10cSrcweir }
369*cdf0e10cSrcweir }
370