Microsoft SDK for Java

Sample IDL Declarations

This section shows some IDL declarations and their corresponding Java declarations.

Declarations with Simple Parameters

HRESULT Func([in] int x);                        void Func(int x);
HRESULT Func([in,out] int* x);                  void Func(int[] x);
HRESULT Func([out,retval] int* x);               int Func();

Declarations with String Parameters

HRESULT Func([in] BSTR x);            void Func(java.lang.String x);
HRESULT Func([in,out] BSTR* x);      void Func(java.lang.String[] x);
HRESULT Func([out,retval] BSTR* x);   java.lang.String Func();

Declarations with VARIANT Parameters

HRESULT Func([in] VARIANT x);            void Func(com.ms.com.Variant x);
HRESULT Func([in] VARIANT* x);         void Func(com.ms.com.Variant x);
HRESULT Func([in,out] VARIANT* x);      void Func(com.ms.com.Variant x);
HRESULT Func([out,retval] VARIANT* x);   com.ms.com.Variant Func();
HRESULT Func([in,out] VARIANT** x);      void Func(com.ms.com.Variant[] x);

Declarations with Interface Pointer Parameters

HRESULT Func([in] IBar* x);         void Func(IBar x);
HRESULT Func([in,out] IBar** x);      void Func(IBar[] x);
HRESULT Func([out,retval] IBar** x);IBar Func();

For more information on HRESULTs returned by COM functions, see Handling COM Errors in Java.

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