This document introduces custom marshaling which is
implemented between Java and COM. Basically, this involves the
writing of a HOOK CLASS to do the marshaling, and the use of the
JActiveX tool to create a Java type library file that describes the
custom interface.
Suppose you have a COM library that uses various data types as
parameters and return values for its methods. For these methods
to be callable from Java, the data types need to be converted
between the COM types and Java types. For some types, like
integers, floats, booleans, and strings, the Microsoft VM for
Java provides intrinsic marshaling support that does the type
conversion for you.
Besides the conversion work, the COM types must be represented
as Java types in order to be callable from Java. This requires a
Java class file that contains type declarations in Java format.
This class file is usually created by running a type-conversion
tool such as JActiveX or JavaTLB on the typelib of the COM server.
These conversion tools generate the proper type mappings for all
types that that are supported by the intrinsic marshaling of the
VM.
However, the VM does not have intrinsic support for complex
COM library data types such as C structures. In such cases, you
will need to create a user-defined Java type and write a HOOK
CLASS that does the marshaling.
Also, JActiveX cannot automatically create type mappings that will
work for user-defined types. You will need to tell JActiveX how to
generate the Java type declarations. You do this by creating a
Java Information (.JNF) file that describes your custom data
types, and passing this extra file to JActiveX when it creates the
COM library class header file.
Please view the CustomMarshal.txt file contained within the directory for additional information.