Microsoft SDK for Java

Parameters Passed by Reference

COM interface methods can have parameters that pass simple types by reference, such as integers, floating point values, and characters. In most cases, these parameters are out parameters. For example, the COM method MySample has the following signature:

HRESULT MySample([in] long l, [out] long* Out1, [out, retval] long* retval);

Java does not support parameters that are references to the intrinsic data types, and it does not support pointers. But you can still call MySample from Java. Reference types are mapped to one-element arrays by the Microsoft VM. Therefore, you can retrieve a reference as shown in the following example:

int A;
int B[] = new int[1];
A = MySample(42, B);
System.out.println("A = " + A + " and B = " + B[0]);

Use the jactivex tool to load and invoke COM and Automation objects directly from your Java source. Custom marshaling provides some support for types not supported by Automation.

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