xref: /trunk/main/bridges/source/cpp_uno/gcc3_linux_powerpc/uno2cpp.cxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_bridges.hxx"
30 
31 #include <malloc.h>
32 
33 #include <com/sun/star/uno/genfunc.hxx>
34 #include <uno/data.h>
35 
36 #include "bridges/cpp_uno/shared/bridge.hxx"
37 #include "bridges/cpp_uno/shared/types.hxx"
38 #include "bridges/cpp_uno/shared/unointerfaceproxy.hxx"
39 #include "bridges/cpp_uno/shared/vtables.hxx"
40 
41 #include "share.hxx"
42 
43 
44 using namespace ::rtl;
45 using namespace ::com::sun::star::uno;
46 
47 namespace
48 {
49 
50 
51 //==================================================================================================
52 static void callVirtualMethod(
53     void * pAdjustedThisPtr,
54     sal_Int32 nVtableIndex,
55     void * pRegisterReturn,
56     typelib_TypeClass eReturnType,
57     char * pPT,
58     sal_Int32 * pStackLongs,
59     sal_Int32 nStackLongs)
60 {
61 
62   // parameter list is mixed list of * and values
63   // reference parameters are pointers
64 
65   // the basic idea here is to use gpr[8] as a storage area for
66   // the future values of registers r3 to r10 needed for the call,
67   // and similarly fpr[8] as a storage area for the future values
68   // of floating point registers f1 to f8
69 
70      unsigned long * mfunc;        // actual function to be invoked
71      void (*ptr)();
72      int gpr[8];                   // storage for gpregisters, map to r3-r10
73      int off;                      // offset used to find function
74 #ifndef __NO_FPRS__
75      double fpr[8];                // storage for fpregisters, map to f1-f8
76      int f;                        // number of fprs mapped so far
77      double dret;                  // temporary function return values
78 #endif
79      int n;                        // number of gprs mapped so far
80      long *p;                      // pointer to parameter overflow area
81      int c;                        // character of parameter type being decoded
82      int iret, iret2;
83 
84      // Because of the Power PC calling conventions we could be passing
85      // parameters in both register types and on the stack. To create the
86      // stack parameter area we need we now simply allocate local
87      // variable storage param[] that is at least the size of the parameter stack
88      // (more than enough space) which we can overwrite the parameters into.
89 
90      // Note: This keeps us from having to decode the signature twice and
91      // prevents problems with later local variables.
92 
93      // Note: could require up to  2*nStackLongs words of parameter stack area
94      // if the call has many float parameters (i.e. floats take up only 1
95      // word on the stack but double takes 2 words in parameter area in the
96      // stack frame .
97 
98      // Update! floats on the outgoing parameter stack only take up 1 word
99      // (stfs is used) which is not correct according to the ABI but we
100      // will match what the compiler does until this is figured out
101 
102      // this grows the current stack to the appropriate size
103      // and sets the outgoing stack pointer p to the right place
104      __asm__ __volatile__ (
105           "rlwinm %0,%0,3,3,28\n\t"
106           "addi %0,%0,22\n\t"
107           "rlwinm %0,%0,0,4,28\n\t"
108           "lwz 0,0(1)\n\t"
109           "subf 1,%0,1\n\t"
110           "stw 0,0(1)\n\t"
111           : : "r" (nStackLongs) : "0" );
112 
113      __asm__ __volatile__ ( "addi %0,1,8" : "=r" (p) : );
114 
115      // never called
116      // if (! pAdjustedThisPtr ) dummy_can_throw_anything("xxx"); // address something
117 
118 
119      // now begin to load the C++ function arguments into storage
120      n = 0;
121 #ifndef __NO_FPRS__
122      f = 0;
123 #endif
124 
125      // now we need to parse the entire signature string */
126      // until we get the END indicator */
127 
128      // treat complex return pointer like any other parameter //
129 
130 #if 0
131      /* Let's figure out what is really going on here*/
132      fprintf(stderr,"callVirtualMethod paramters string is %s\n",pPT);
133      int k = nStackLongs;
134      long * q = (long *)pStackLongs;
135      while (k > 0) {
136        fprintf(stderr,"uno stack is: %x\n",*q);
137        k--;
138        q++;
139      }
140 #endif
141 
142      /* parse the argument list up to the ending ) */
143      while (*pPT != 'X') {
144        c = *pPT;
145        switch (c) {
146        case 'D':                   /* type is double */
147 #ifndef __NO_FPRS__
148             if (f < 8) {
149                fpr[f++] = *((double *)pStackLongs);   /* store in register */
150 #else
151             if (n & 1)
152                n++;
153             if (n < 8) {
154                gpr[n++] = *pStackLongs;
155                gpr[n++] = *(pStackLongs+1);
156 #endif
157         } else {
158            if (((long) p) & 4)
159               p++;
160                *p++ = *pStackLongs;       /* or on the parameter stack */
161                *p++ = *(pStackLongs + 1);
162         }
163             pStackLongs += 2;
164             break;
165 
166        case 'F':                   /* type is float */
167      /* this assumes that floats are stored as 1 32 bit word on param
168         stack and that if passed in parameter stack to C, should be
169         as double word.
170 
171             Whoops: the abi is not actually followed by gcc, need to
172             store floats as a *single* word on outgoing parameter stack
173             to match what gcc actually does
174      */
175 #ifndef __NO_FPRS__
176             if (f < 8) {
177                fpr[f++] = *((float *)pStackLongs);
178 #else
179             if (n < 8) {
180                gpr[n++] = *pStackLongs;
181 #endif
182         } else {
183 #if 0 /* if abi were followed */
184            if (((long) p) & 4)
185               p++;
186            *((double *)p) = *((float *)pStackLongs);
187                p += 2;
188 #else
189            *((float *)p) = *((float *)pStackLongs);
190                p += 1;
191 #endif
192         }
193             pStackLongs += 1;
194             break;
195 
196        case 'H':                /* type is long long */
197             if (n & 1) n++;     /* note even elements gpr[] will map to
198                                    odd registers*/
199             if (n <= 6) {
200                gpr[n++] = *pStackLongs;
201                gpr[n++] = *(pStackLongs+1);
202         } else {
203            if (((long) p) & 4)
204               p++;
205                *p++ = *pStackLongs;
206                *p++ = *(pStackLongs+1);
207         }
208             pStackLongs += 2;
209             break;
210 
211        case 'S':
212             if (n < 8) {
213                gpr[n++] = *((unsigned short*)pStackLongs);
214         } else {
215                *p++ = *((unsigned short *)pStackLongs);
216         }
217             pStackLongs += 1;
218             break;
219 
220        case 'B':
221             if (n < 8) {
222                gpr[n++] = *((char *)pStackLongs);
223         } else {
224                *p++ = *((char *)pStackLongs);
225         }
226             pStackLongs += 1;
227             break;
228 
229        default:
230             if (n < 8) {
231                gpr[n++] = *pStackLongs;
232         } else {
233                *p++ = *pStackLongs;
234         }
235             pStackLongs += 1;
236             break;
237        }
238        pPT++;
239      }
240 
241      /* figure out the address of the function we need to invoke */
242      off = nVtableIndex;
243      off = off * 4;                         // 4 bytes per slot
244      mfunc = *((unsigned long **)pAdjustedThisPtr);    // get the address of the vtable
245      mfunc = (unsigned long *)((char *)mfunc + off); // get the address from the vtable entry at offset
246      mfunc = *((unsigned long **)mfunc);                 // the function is stored at the address
247      ptr = (void (*)())mfunc;
248 
249     /* Set up the machine registers and invoke the function */
250 
251     __asm__ __volatile__ (
252         "lwz    3,  0(%0)\n\t"
253         "lwz    4,  4(%0)\n\t"
254         "lwz    5,  8(%0)\n\t"
255         "lwz    6,  12(%0)\n\t"
256         "lwz    7,  16(%0)\n\t"
257         "lwz    8,  20(%0)\n\t"
258         "lwz    9,  24(%0)\n\t"
259         "lwz    10, 28(%0)\n\t"
260 #ifndef __NO_FPRS__
261         "lfd    1,  0(%1)\n\t"
262         "lfd    2,  8(%1)\n\t"
263         "lfd    3,  16(%1)\n\t"
264         "lfd    4,  24(%1)\n\t"
265         "lfd    5,  32(%1)\n\t"
266         "lfd    6,  40(%1)\n\t"
267         "lfd    7,  48(%1)\n\t"
268         "lfd    8,  56(%1)\n\t"
269             : : "r" (gpr), "r" (fpr)
270 #else
271             : : "r" (gpr)
272 #endif
273         : "0", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"
274     );
275 
276     (*ptr)();
277 
278     __asm__ __volatile__ (
279        "mr     %0,     3\n\t"
280        "mr     %1,     4\n\t"
281 #ifndef __NO_FPRS__
282        "fmr    %2,     1\n\t"
283        : "=r" (iret), "=r" (iret2), "=f" (dret)
284 #else
285        : "=r" (iret), "=r" (iret2)
286 #endif
287        : );
288 
289     switch( eReturnType )
290     {
291         case typelib_TypeClass_HYPER:
292         case typelib_TypeClass_UNSIGNED_HYPER:
293                 ((long*)pRegisterReturn)[0] = iret;
294             ((long*)pRegisterReturn)[1] = iret2;
295         case typelib_TypeClass_LONG:
296         case typelib_TypeClass_UNSIGNED_LONG:
297         case typelib_TypeClass_ENUM:
298             ((long*)pRegisterReturn)[0] = iret;
299             break;
300         case typelib_TypeClass_CHAR:
301         case typelib_TypeClass_SHORT:
302         case typelib_TypeClass_UNSIGNED_SHORT:
303                 *(unsigned short*)pRegisterReturn = (unsigned short)iret;
304             break;
305         case typelib_TypeClass_BOOLEAN:
306         case typelib_TypeClass_BYTE:
307                 *(unsigned char*)pRegisterReturn = (unsigned char)iret;
308             break;
309         case typelib_TypeClass_FLOAT:
310 #ifndef __NO_FPRS__
311                 *(float*)pRegisterReturn = (float)dret;
312 #else
313                 ((unsigned int*)pRegisterReturn)[0] = iret;
314 #endif
315             break;
316         case typelib_TypeClass_DOUBLE:
317 #ifndef __NO_FPRS__
318             *(double*)pRegisterReturn = dret;
319 #else
320             ((unsigned int*)pRegisterReturn)[0] = iret;
321             ((unsigned int*)pRegisterReturn)[1] = iret2;
322 #endif
323             break;
324         default:
325             break;
326     }
327 }
328 
329 
330 //==================================================================================================
331 static void cpp_call(
332     bridges::cpp_uno::shared::UnoInterfaceProxy * pThis,
333     bridges::cpp_uno::shared::VtableSlot  aVtableSlot,
334     typelib_TypeDescriptionReference * pReturnTypeRef,
335     sal_Int32 nParams, typelib_MethodParameter * pParams,
336     void * pUnoReturn, void * pUnoArgs[], uno_Any ** ppUnoExc )
337 {
338     // max space for: [complex ret ptr], values|ptr ...
339     char * pCppStack        =
340         (char *)alloca( sizeof(sal_Int32) + ((nParams+2) * sizeof(sal_Int64)) );
341     char * pCppStackStart   = pCppStack;
342 
343         // need to know parameter types for callVirtualMethod so generate a signature string
344         char * pParamType = (char *) alloca(nParams+2);
345         char * pPT = pParamType;
346 
347     // return
348     typelib_TypeDescription * pReturnTypeDescr = 0;
349     TYPELIB_DANGER_GET( &pReturnTypeDescr, pReturnTypeRef );
350     // OSL_ENSURE( pReturnTypeDescr, "### expected return type description!" );
351 
352     void * pCppReturn = 0; // if != 0 && != pUnoReturn, needs reconversion
353 
354     if (pReturnTypeDescr)
355     {
356         if (bridges::cpp_uno::shared::isSimpleType( pReturnTypeDescr ))
357         {
358             pCppReturn = pUnoReturn; // direct way for simple types
359         }
360         else
361         {
362             // complex return via ptr
363             pCppReturn = *(void **)pCppStack =
364                               (bridges::cpp_uno::shared::relatesToInterfaceType( pReturnTypeDescr )
365                    ? alloca( pReturnTypeDescr->nSize ): pUnoReturn); // direct way
366                         *pPT++ = 'I'; //signify that a complex return type on stack
367             pCppStack += sizeof(void *);
368         }
369     }
370     // push this
371         void* pAdjustedThisPtr = reinterpret_cast< void **>(pThis->getCppI()) + aVtableSlot.offset;
372     *(void**)pCppStack = pAdjustedThisPtr;
373     pCppStack += sizeof( void* );
374         *pPT++ = 'I';
375 
376     // stack space
377     // OSL_ENSURE( sizeof(void *) == sizeof(sal_Int32), "### unexpected size!" );
378     // args
379     void ** pCppArgs  = (void **)alloca( 3 * sizeof(void *) * nParams );
380     // indizes of values this have to be converted (interface conversion cpp<=>uno)
381     sal_Int32 * pTempIndizes = (sal_Int32 *)(pCppArgs + nParams);
382     // type descriptions for reconversions
383     typelib_TypeDescription ** ppTempParamTypeDescr = (typelib_TypeDescription **)(pCppArgs + (2 * nParams));
384 
385     sal_Int32 nTempIndizes   = 0;
386 
387     for ( sal_Int32 nPos = 0; nPos < nParams; ++nPos )
388     {
389         const typelib_MethodParameter & rParam = pParams[nPos];
390         typelib_TypeDescription * pParamTypeDescr = 0;
391         TYPELIB_DANGER_GET( &pParamTypeDescr, rParam.pTypeRef );
392 
393         if (!rParam.bOut && bridges::cpp_uno::shared::isSimpleType( pParamTypeDescr ))
394         {
395             uno_copyAndConvertData( pCppArgs[nPos] = pCppStack, pUnoArgs[nPos], pParamTypeDescr,
396                                     pThis->getBridge()->getUno2Cpp() );
397 
398             switch (pParamTypeDescr->eTypeClass)
399             {
400 
401                           // we need to know type of each param so that we know whether to use
402                           // gpr or fpr to pass in parameters:
403                           // Key: I - int, long, pointer, etc means pass in gpr
404                           //      B - byte value passed in gpr
405                           //      S - short value passed in gpr
406                           //      F - float value pass in fpr
407                           //      D - double value pass in fpr
408                           //      H - long long int pass in proper pairs of gpr (3,4) (5,6), etc
409                           //      X - indicates end of parameter description string
410 
411                   case typelib_TypeClass_LONG:
412                   case typelib_TypeClass_UNSIGNED_LONG:
413                   case typelib_TypeClass_ENUM:
414                 *pPT++ = 'I';
415                 break;
416                   case typelib_TypeClass_SHORT:
417                   case typelib_TypeClass_CHAR:
418                   case typelib_TypeClass_UNSIGNED_SHORT:
419                             *pPT++ = 'S';
420                             break;
421                   case typelib_TypeClass_BOOLEAN:
422                   case typelib_TypeClass_BYTE:
423                             *pPT++ = 'B';
424                             break;
425                   case typelib_TypeClass_FLOAT:
426                             *pPT++ = 'F';
427                 break;
428                 case typelib_TypeClass_DOUBLE:
429                 *pPT++ = 'D';
430                 pCppStack += sizeof(sal_Int32); // extra long
431                 break;
432             case typelib_TypeClass_HYPER:
433             case typelib_TypeClass_UNSIGNED_HYPER:
434                 *pPT++ = 'H';
435                 pCppStack += sizeof(sal_Int32); // extra long
436             default:
437                 break;
438             }
439 
440             // no longer needed
441             TYPELIB_DANGER_RELEASE( pParamTypeDescr );
442         }
443         else // ptr to complex value | ref
444         {
445             if (! rParam.bIn) // is pure out
446             {
447                 // cpp out is constructed mem, uno out is not!
448                 uno_constructData(
449                     *(void **)pCppStack = pCppArgs[nPos] = alloca( pParamTypeDescr->nSize ),
450                     pParamTypeDescr );
451                 pTempIndizes[nTempIndizes] = nPos; // default constructed for cpp call
452                 // will be released at reconversion
453                 ppTempParamTypeDescr[nTempIndizes++] = pParamTypeDescr;
454             }
455             // is in/inout
456             else if (bridges::cpp_uno::shared::relatesToInterfaceType( pParamTypeDescr ))
457             {
458                 uno_copyAndConvertData(
459                     *(void **)pCppStack = pCppArgs[nPos] = alloca( pParamTypeDescr->nSize ),
460                     pUnoArgs[nPos], pParamTypeDescr,
461                                         pThis->getBridge()->getUno2Cpp() );
462 
463                 pTempIndizes[nTempIndizes] = nPos; // has to be reconverted
464                 // will be released at reconversion
465                 ppTempParamTypeDescr[nTempIndizes++] = pParamTypeDescr;
466             }
467             else // direct way
468             {
469                 *(void **)pCppStack = pCppArgs[nPos] = pUnoArgs[nPos];
470                 // no longer needed
471                 TYPELIB_DANGER_RELEASE( pParamTypeDescr );
472             }
473                         // KBH: FIXME: is this the right way to pass these
474                         *pPT++='I';
475         }
476         pCppStack += sizeof(sal_Int32); // standard parameter length
477     }
478 
479         // terminate the signature string
480         *pPT++='X';
481         *pPT=0;
482 
483     try
484     {
485         OSL_ENSURE( !( (pCppStack - pCppStackStart ) & 3), "UNALIGNED STACK !!! (Please DO panic)" );
486         callVirtualMethod(
487             pAdjustedThisPtr, aVtableSlot.index,
488             pCppReturn, pReturnTypeDescr->eTypeClass, pParamType,
489             (sal_Int32 *)pCppStackStart, (pCppStack - pCppStackStart) / sizeof(sal_Int32) );
490         // NO exception occured...
491         *ppUnoExc = 0;
492 
493         // reconvert temporary params
494         for ( ; nTempIndizes--; )
495         {
496             sal_Int32 nIndex = pTempIndizes[nTempIndizes];
497             typelib_TypeDescription * pParamTypeDescr = ppTempParamTypeDescr[nTempIndizes];
498 
499             if (pParams[nIndex].bIn)
500             {
501                 if (pParams[nIndex].bOut) // inout
502                 {
503                     uno_destructData( pUnoArgs[nIndex], pParamTypeDescr, 0 ); // destroy uno value
504                     uno_copyAndConvertData( pUnoArgs[nIndex], pCppArgs[nIndex], pParamTypeDescr,
505                                             pThis->getBridge()->getCpp2Uno() );
506                 }
507             }
508             else // pure out
509             {
510                 uno_copyAndConvertData( pUnoArgs[nIndex], pCppArgs[nIndex], pParamTypeDescr,
511                                         pThis->getBridge()->getCpp2Uno() );
512             }
513             // destroy temp cpp param => cpp: every param was constructed
514             uno_destructData( pCppArgs[nIndex], pParamTypeDescr, cpp_release );
515 
516             TYPELIB_DANGER_RELEASE( pParamTypeDescr );
517         }
518         // return value
519         if (pCppReturn && pUnoReturn != pCppReturn)
520         {
521             uno_copyAndConvertData( pUnoReturn, pCppReturn, pReturnTypeDescr,
522                                     pThis->getBridge()->getCpp2Uno() );
523             uno_destructData( pCppReturn, pReturnTypeDescr, cpp_release );
524         }
525     }
526     catch (...)
527     {
528         // fill uno exception
529         fillUnoException( CPPU_CURRENT_NAMESPACE::__cxa_get_globals()->caughtExceptions,
530                                   *ppUnoExc, pThis->getBridge()->getCpp2Uno() );
531 
532         // temporary params
533         for ( ; nTempIndizes--; )
534         {
535             sal_Int32 nIndex = pTempIndizes[nTempIndizes];
536             // destroy temp cpp param => cpp: every param was constructed
537             uno_destructData( pCppArgs[nIndex], ppTempParamTypeDescr[nTempIndizes], cpp_release );
538             TYPELIB_DANGER_RELEASE( ppTempParamTypeDescr[nTempIndizes] );
539         }
540         // return type
541         if (pReturnTypeDescr)
542             TYPELIB_DANGER_RELEASE( pReturnTypeDescr );
543     }
544 }
545 
546 }
547 
548 namespace bridges { namespace cpp_uno { namespace shared {
549 
550 void unoInterfaceProxyDispatch(
551     uno_Interface * pUnoI, const typelib_TypeDescription * pMemberDescr,
552     void * pReturn, void * pArgs[], uno_Any ** ppException )
553 {
554     // is my surrogate
555         bridges::cpp_uno::shared::UnoInterfaceProxy * pThis
556             = static_cast< bridges::cpp_uno::shared::UnoInterfaceProxy *> (pUnoI);
557 
558     switch (pMemberDescr->eTypeClass)
559     {
560     case typelib_TypeClass_INTERFACE_ATTRIBUTE:
561     {
562 
563         VtableSlot aVtableSlot(
564             getVtableSlot(
565                 reinterpret_cast<
566                     typelib_InterfaceAttributeTypeDescription const * >(
567                         pMemberDescr)));
568 
569         if (pReturn)
570         {
571             // dependent dispatch
572             cpp_call(
573                 pThis, aVtableSlot,
574                 ((typelib_InterfaceAttributeTypeDescription *)pMemberDescr)->pAttributeTypeRef,
575                 0, 0, // no params
576                 pReturn, pArgs, ppException );
577         }
578         else
579         {
580             // is SET
581             typelib_MethodParameter aParam;
582             aParam.pTypeRef =
583                 ((typelib_InterfaceAttributeTypeDescription *)pMemberDescr)->pAttributeTypeRef;
584             aParam.bIn      = sal_True;
585             aParam.bOut     = sal_False;
586 
587             typelib_TypeDescriptionReference * pReturnTypeRef = 0;
588             OUString aVoidName( RTL_CONSTASCII_USTRINGPARAM("void") );
589             typelib_typedescriptionreference_new(
590                 &pReturnTypeRef, typelib_TypeClass_VOID, aVoidName.pData );
591 
592             // dependent dispatch
593                         aVtableSlot.index += 1; //get then set method
594             cpp_call(
595                 pThis, aVtableSlot,
596                 pReturnTypeRef,
597                 1, &aParam,
598                 pReturn, pArgs, ppException );
599 
600             typelib_typedescriptionreference_release( pReturnTypeRef );
601         }
602 
603         break;
604     }
605     case typelib_TypeClass_INTERFACE_METHOD:
606     {
607 
608         VtableSlot aVtableSlot(
609             getVtableSlot(
610                 reinterpret_cast<
611                     typelib_InterfaceMethodTypeDescription const * >(
612                         pMemberDescr)));
613         switch (aVtableSlot.index)
614         {
615             // standard calls
616         case 1: // acquire uno interface
617             (*pUnoI->acquire)( pUnoI );
618             *ppException = 0;
619             break;
620         case 2: // release uno interface
621             (*pUnoI->release)( pUnoI );
622             *ppException = 0;
623             break;
624         case 0: // queryInterface() opt
625         {
626             typelib_TypeDescription * pTD = 0;
627             TYPELIB_DANGER_GET( &pTD, reinterpret_cast< Type * >( pArgs[0] )->getTypeLibType() );
628             if (pTD)
629             {
630                 uno_Interface * pInterface = 0;
631                 (*pThis->pBridge->getUnoEnv()->getRegisteredInterface)(
632                     pThis->pBridge->getUnoEnv(),
633                     (void **)&pInterface, pThis->oid.pData, (typelib_InterfaceTypeDescription *)pTD );
634 
635                 if (pInterface)
636                 {
637                     ::uno_any_construct(
638                         reinterpret_cast< uno_Any * >( pReturn ),
639                         &pInterface, pTD, 0 );
640                     (*pInterface->release)( pInterface );
641                     TYPELIB_DANGER_RELEASE( pTD );
642                     *ppException = 0;
643                     break;
644                 }
645                 TYPELIB_DANGER_RELEASE( pTD );
646             }
647         } // else perform queryInterface()
648         default:
649             // dependent dispatch
650             cpp_call(
651                 pThis, aVtableSlot,
652                 ((typelib_InterfaceMethodTypeDescription *)pMemberDescr)->pReturnTypeRef,
653                 ((typelib_InterfaceMethodTypeDescription *)pMemberDescr)->nParams,
654                 ((typelib_InterfaceMethodTypeDescription *)pMemberDescr)->pParams,
655                 pReturn, pArgs, ppException );
656         }
657         break;
658     }
659     default:
660     {
661         ::com::sun::star::uno::RuntimeException aExc(
662             OUString( RTL_CONSTASCII_USTRINGPARAM("illegal member type description!") ),
663             ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >() );
664 
665         Type const & rExcType = ::getCppuType( &aExc );
666         // binary identical null reference
667         ::uno_type_any_construct( *ppException, &aExc, rExcType.getTypeLibType(), 0 );
668     }
669     }
670 }
671 
672 } } }
673