Export (0) Print
Expand All

Upgrading Java-Language/COM Components That Use Custom Marshaling

Visual Studio 2005

Visual J++ 6.0 allows developers to custom marshal method parameters and structures during Java-language/COM interop. When the /t jnffile or the /n jnffile option is used when running the JActiveX tool on a type library, the wrappers generated contain additional information required for custom marshaling. The .jnf file used with the /t or /n option specifies the custom marshaler class that must be used to marshal a specific Java-language type to the corresponding native type. Additional information on custom marshaling in Visual J++ 6.0 can be found in the documentation for Microsoft Visual J++ 6.0 or the Microsoft SDK for Java.

Microsoft Visual J# does not currently support custom marshaling. Attempting to compile JActiveX wrappers that use custom marshalers to marshal Java-language types to native types results in a compile-time error.

The common language runtime provides native support for COM interop and custom marshaling. Users can specify a custom marshaler class that can be used to custom marshal managed types to their corresponding native representations and vice versa. For additional information on custom marshaling on the common language runtime, see Custom Marshaling.

When upgrading Java-language/COM applications that use custom marshaling, a possible upgrade path is to rewrite the component to directly use the managed wrappers generated by the Tlbimp.exe tool rather than use the JActiveX wrappers. The common language runtime allows developers to specify custom marshaling classes that marshal method arguments during COM interop. By writing such a custom marshaler, you can marshal a managed type written in Java-language to its native representation.

Community Additions

ADD
Show:
© 2014 Microsoft