Microsoft SDK for Java

COM_MethodPool

The COM_MethodPool attribute stores the signatures of the COM methods that are invoked by and implemented by the Java methods in the .class file. These signatures (MCFuncDescs) are referenced by index by other attributes in the class. Valid indices range from 0 inclusive to nFuncs exclusive. The index 0xffff is reserved to indicate the "null" index.

Attribute Level Generated By Directives
Class @com.method
@com.parameters

COM_MethodPool_attribute {
  u2 attribute_name_index;
  u4 attribute_length;
  u2 nFuncs
  // MCFuncDesc aMCFunc[nFuncs]
}

The C structure MCMethodPool, declared in comattr.h, defines the layout of this attribute for use in C/C++ programs.

Restrictions

The class access flags must be a subset of ACC_PUBLIC, ACC_FINAL, ACC_INTERFACE, or ACC_ABSTRACT.

Though the MCFuncDesc structure allows you to specify an IID for an individual MCFuncDesc, the Microsoft virtual machine requires that all MCFuncDescs in a .class file reference the same IID in the GuidPool. (This restriction does not apply to IIDs embedded in the MCTypeDescs within the parameter arrays and return types of the MCFuncDescs.)

Attribute Elements

attribute_name_index

This value must be a valid index into the constant_pool table. The constant_pool entry at that index must be the CONSTANT_Utf8_info structure representing the string "COM_MethodPool".

attribute_length

This value indicates the length of this attribute, excluding the initial six bytes, and varies depending on the value of nFuncs. The attribute_length must have a minimum value of 2.

nFuncs

This field indicates the number of MCFuncDescs defined in this table.

MCFuncDesc aFuncDesc[nFuncs]

This array stores the actual MCFuncDescs. MCFuncDescs are variable-sized structures.

The @com.method directive that generates an entry for this attribute has the following syntax:

/** @com.method([vtoffset=integer | long], [dispid=integer | long], 
[name=string], [name2=string], [type=METHOD | PROPGET | PROPPUT 
| PROPPUTREF], [thread=AUTO | NO], [nodispatch], [returntype=VOID 
| HRESULT], [addFlagsVtable=integer], [addFlagsDispatch=integer]) */

The name2 parameter requires that the interface be DUAL or dispatch.

An example of the @com.method directive that generates item data for this attribute has the following syntax:

/** @com.method(vtoffset=0) */

The @com.parameters directive that generates an entry for this attribute has the following syntax:

/** @com.parameters([parameters] methodParamName1, [parameters]
 methodParamName2, … [[parameters] return]) */

Valid types for a vtable class include array, BOOLEAN, CURRENCY, CUSTOM, CUSTOMBYREF, CUSTOMBYVAL, DATE, DISPATCH, numeric types, PTR, SAFEARRAY, STRING, STRUCT, and VARIANT. Valid types for dispatch class include numeric types except I8 and U8 (unless nodispatch is specified in the @com.method directive), array, BOOLEAN, CURRENCY, DATE, DISPATCH, OBJECT, PTR (when the parameter is of type com.ms.com.Variant), SAFEARRAY, STRING, and VARIANT.

The elementType parameter should be specified only if type = PTR or type = ARRAY. The vt parameter is required if type = SAFEARRAY. The size parameter should be specified only if type = ARRAY or type = STRUCT. When specifying information about the return type, return is used as the <parameter name>.

Any forms of these @com.method or @com.parameters directives create an entry that will be compiled into the COM_MethodPool attribute for a Java/COM class.

See Also

MCCustomMethod (includes MCSpecialArgumentEntry)
MCDispMethod
MCFuncDesc
MCTypeDesc
MCVarTypeDesc
MCVtblMethod

© 1999 Microsoft Corporation. All rights reserved. Terms of use.