On occasion, you may want a new .idl file to reference some element that the SOM Compiler would not recognize, such as a user-defined class or an instance variable or attribute with a user-defined data type. You can reference such elements if they already exist in .h or .xh files that the SOM Compiler can #include with your new .idl file, as follows:
In the following example, the generic SOM type somToken is used in the .idl file for the user's types "myRealType" and "myStructType". The passthru statement then causes an appropriate #include statement to be emitted into the C/C++ binding file, so that the file defining types "myRealType" and "myStructType" will be included when the binding files process. In addition, an interface declaration for "myOtherClass" is defined as a forward reference, so that an instance of that class can be used within the definition of "myCurrentClass". The passthru statement also #includes the binding file for "myOtherClass":
typedef somToken myRealType;typedef somToken myStructType; interface myOtherClass; interface myCurrentClass : SOMObject { . . . implementation { . . . myRealType myInstVar; attribute myStructType st1; passthru C_h = "" "#include <myTypes.h>" "#include <myOtherClass.h>" ""; }; };
Note: See also the section "Using the tk_foreign TypeCode" in Chapter 7, "The Interface Repository Framework."