The COM_MethodPool attribute uses an MCFuncDesc structure to store a method signature for each of the COM methods that are invoked by and implemented by the Java methods in the Java class file. This method signature indicates the parameters and return value of a method as well as the method name. These signatures (MCFuncDesc structures) are referenced by index by other attributes in the class. Valid indices range from 0 (zero) inclusive to nFuncs exclusive. The index 0xffff is reserved to indicate the null index.
FuncDesc_attribute { u2 cbSize; u2 Flags; union { MCVtblMethod mvm; MCDispMethod mdm; MCCustomMethod mcm; }; };
The C structure MCFuncDesc, declared in comattr.h, defines the layout of this attribute for use in C/C++ programs.
cbSize
This value indicates the size of entire MCFuncDesc structure in bytes including the cbSize member.
Flags
The following table describes the flags used by the FuncDesc attribute.
Flag | Value | Meaning |
MCMDF_DISPATCH | 0x0001 | Indicates that the function is a dispatch method. |
MCMDF_HRESULT_RETVAL | 0x0002 | Indicates that the return type of the method is an HRESULT and that it is to be mapped to an exception on the Java side. If this option is used, the declared type of the RetVal must be TD_VOID. MCMDF_HRESULT_RETVAL must not be used together with MCMDF_DISPATCH.
When MCMDF_HRESULT_RETVAL is on, the Microsoft VM treats all return values from COM objects as HRESULTs and will throw a Java exception if the HRESULT is not S_OK. Conversely, the Microsoft VM will map all uncaught exceptions from Java code into a failing HRESULT, and will otherwise supply a return value of S_OK. |
MCMDF_IGNORE_ NONFAILING_HRESULTS |
0x0004 | This flag works in conjunction with MCMDF_HRESULT_RETVAL. If this option is set, only HRESULTs that have the high bit set (FAIL) will generate a Java exception. Non-zero HRESULTs that do not set the bit (such as S_FALSE) will not generate an exception. MCMDF_IGNORE_NONFAILING_HRESULTS must not be used together with MCMDF_DISPATCH.
If both the flags MCMDF_HRESULT_RETVAL (0x0002) and MCMDF_IGNORE_NONFAILING_HRESULTS (0x0004) are set, only HRESULTs that have the high bit (FAIL) set will generate a Java exception. Non-zero HRESULTs that do not set the bit (such as S_FALSE) will not generate an exception. |
MCMDF_CUSTOM | 0x0008 | Indicates a custom method. Legal only if none of the other flags are set. |
mvm
If the Flags indicate that this is a vtable method (MCMDF_DISPATCH is not set), the MCVtblMethod structure is used to describe this method.
mdm
If the Flags indicate that this is a dispatch method (MCMDF_DISPATCH is set), a MCDispMethod structure is used to describe this method.
mcm
If the Flags indicate that this is a custom method (MCMDF_CUSTOM is set), a MCCustomMethod structure is used to describe this method.