22#include <osl/diagnose.h>
23#include "rtl/ustrbuf.hxx"
27namespace sr=System::Reflection;
43 typelib_TypeDescriptionReference * return_type,
44 sal_Int32 nParams, typelib_MethodParameter
const * pParams,
45 array<System::Object^>^ args, array<System::Type^>^ argTypes,
46 System::Object^* ppExc)
const
49 sal_Int32 return_size =
sizeof (
largest);
50 if ((0 != return_type) &&
51 (typelib_TypeClass_STRUCT == return_type->eTypeClass ||
52 typelib_TypeClass_EXCEPTION == return_type->eTypeClass))
56 return_size = return_td.
get()->nSize;
71 char * mem = (
char *)alloca(
72 (nParams *
sizeof (
void *)) + return_size + (nParams *
sizeof (
largest)) );
74 void ** uno_args = (
void **)mem;
77 if ( !(member_td->eTypeClass == typelib_TypeClass_INTERFACE_ATTRIBUTE && nParams == 1))
78 uno_ret = (mem + (nParams *
sizeof (
void *)));
79 largest * uno_args_mem = (
largest *)(mem + (nParams *
sizeof (
void *)) + return_size);
81 OSL_ASSERT( (0 == nParams) || (nParams ==
args->Length) );
84 typelib_MethodParameter
const & param = pParams[
nPos ];
85 typelib_TypeDescriptionReference *
type = param.pTypeRef;
87 uno_args[
nPos ] = &uno_args_mem[
nPos ];
88 if (typelib_TypeClass_STRUCT ==
type->eTypeClass ||
89 typelib_TypeClass_EXCEPTION ==
type->eTypeClass)
93 uno_args[
nPos ] = alloca( td.
get()->nSize );
107 for (sal_Int32
n = 0;
n <
nPos; ++
n)
109 typelib_MethodParameter
const & param = pParams[
n];
120 uno_Any * uno_exc = &uno_exc_holder;
123 (*pUnoI->pDispatcher)( pUnoI, member_td, uno_ret, uno_args, &uno_exc );
130 typelib_MethodParameter
const & param = pParams[
nPos ];
131 typelib_TypeDescriptionReference *
type = param.pTypeRef;
136 pin_ptr<System::Object^> ptr = &
args[
nPos];
138 ptr, uno_args[
nPos], param.pTypeRef,
139 argTypes !=
nullptr ? argTypes[
nPos] :
nullptr,
false );
144 for ( sal_Int32
n =
nPos;
n < nParams; ++
n )
154 if (typelib_TypeClass_DOUBLE < type->eTypeClass &&
155 typelib_TypeClass_ENUM !=
type->eTypeClass)
161 if ((0 != return_type) &&
162 (typelib_TypeClass_VOID != return_type->eTypeClass))
167 System::Object^ cli_ret;
169 &cli_ret, uno_ret, return_type,
nullptr,
false);
186 typelib_MethodParameter
const & param = pParams[
nPos ];
193 uno_exc_holder.pType,
nullptr,
false);
199 System::Object^ cliI,
200 sr::MethodInfo^ method,
201 typelib_TypeDescriptionReference * return_type,
202 typelib_MethodParameter * params,
int nParams,
203 void * uno_ret,
void * uno_args [],
uno_Any ** uno_exc )
const
205 array<System::Object^>^
args= gcnew array<System::Object^>(nParams);
208 typelib_MethodParameter
const & param= params[
nPos];
211 pin_ptr<System::Object^> ptr = &
args[
nPos];
213 uno_args[
nPos], param.pTypeRef,
nullptr,
false);
216 System::Object^ retInvoke=
nullptr;
219 retInvoke= method->Invoke(cliI,
args);
221 catch (sr::TargetInvocationException^ e)
223 System::Exception^ exc= e->InnerException;
224 css::uno::TypeDescription td(
mapCliType(exc->GetType()));
227 map_to_uno(memExc.get(), exc, td.get()->pWeakRef,
false);
228 (*uno_exc)->pType= td.get()->pWeakRef;
229 (*uno_exc)->pData= memExc.release();
232 catch (System::Exception^ e)
240 typelib_MethodParameter
const & param = params[
nPos ];
254 for ( sal_Int32
n = 0;
n <
nPos; ++
n )
256 typelib_MethodParameter
const & param = params[
n ];
265 if (0 != return_type)
268 uno_ret, retInvoke, return_type,
false );
typelib_TypeDescription * get() const
void SAL_CALL uno_type_destructData(void *pValue, typelib_TypeDescriptionReference *pType, uno_ReleaseFunc release) SAL_THROW_EXTERN_C()
struct _typelib_TypeDescription typelib_TypeDescription
OUString mapCliString(System::String ^ data)
typelib_TypeDescriptionReference * mapCliType(System::Type^ cliType)
Returns an acquired td.
System::Object call_uno(uno_Interface *pUnoI, typelib_TypeDescription *member_td, typelib_TypeDescriptionReference *return_type, sal_Int32 nParams, typelib_MethodParameter const *pParams, array< System::Object^>^ args, array< System::Type^>^ argTypes, System::Object^ *pException) const
void map_to_uno(void *uno_data, System::Object^ cli_data, typelib_TypeDescriptionReference *type, bool assign) const
void call_cli(System::Object^ cliI, sr::MethodInfo^ method, typelib_TypeDescriptionReference *return_type, typelib_MethodParameter *params, int nParams, void *uno_ret, void *uno_args[], uno_Any **uno_exc) const
void map_to_cli(System::Object^ *cli_data, void const *uno_data, typelib_TypeDescriptionReference *type, System::Type^ info, bool bDontCreateObj) const
static std::unique_ptr< rtl_mem > allocate(std::size_t bytes)