The following figure shows how an IDL file is processed by the SOM compiler:
Environment Variables C Bindings ┌────────────────────┐ ┌───────────────┐ │┌────────────────┐ │ │ ┌────┐ ┌────┐ │ ││ SET SMINCLUDE= │ │ │ │.IH │ │ .H │ │ │└────────────────┘ │ ┌────────┐ │ └────┘ └────┘ │ │┌────────────────┐ │────────│ │ ┌──│ ┌────┐ ┌────┐ │ ││ SET SMEMIT= │ │ │ SOM │ │ │ │ .C │ │.PDL│ │ │└────────────────┘ │ ┌──│Compiler│────┤ │ └────┘ └────┘ │ │┌────────────────┐ │ │ │ │ │ │ ┌────┐ │ ││ SET SMTMP= │ │ │ └────────┘ │ │ │.DEF│ │ │└────────────────┘ │ │ │ │ └────┘ │ │┌────────────────┐ │ │ │ └───────────────┘ ││ SET SOMIR= │ │ │ │OR │└────────────────┘ │ │ │ C++ Bindings └────────────────────┘ │ │ ┌───────────────┐ │ │ │ ┌────┐ ┌────┐ │ ┌────────────────┐ │ │ │ │.XIH│ │.XH │ │ │ .IDL │────────┘ └──│ └────┘ └────┘ │ └────────────────┘ │ ┌────┐ ┌────┐ │ │ │.CPP│ │.PDL│ │ │ └────┘ └────┘ │ │ ┌────┐ │ │ │.DEF│ │ │ └────┘ │ └───────────────┘
The SOM compiler processes the IDL file for a SOM class and generates a set of language binding files. The file name of a SOM C-language binding file corresponds to that of the IDL file processed by the SOM compiler, unless the filestem modifier was specified in the IDL file. Each SOM C-language file has a different extension. For example, the SOM compiler processes EXAMPLE.IDL and generates EXAMPLE.C, EXAMPLE.H, and so forth. The language binding files generated by the SOM compiler are described in the following table:
┌────────────┬────────────┬────────────────────────────────────┐ │C Extension │C++ │Description │ │ │Extension │ │ ├────────────┼────────────┼────────────────────────────────────┤ │.C │.CPP │Template for C-language source │ │ │ │program for the class │ │ │ │implementation. │ ├────────────┼────────────┼────────────────────────────────────┤ │.DEF │.DEF │Instructions to the Linker about how│ │ │ │to build a class library. │ ├────────────┼────────────┼────────────────────────────────────┤ │.H │.XH │Public Include file for all │ │ │ │C-language programs that need to │ │ │ │access the SOM class. │ ├────────────┼────────────┼────────────────────────────────────┤ │.IH │.XIH │Implementation header containing │ │ │ │most of the automatically generated │ │ │ │implementation details about the │ │ │ │class. │ ├────────────┼────────────┼────────────────────────────────────┤ │.PDL │.PDL │Language-neutral form and subset of │ │ │ │the SOM IDL file with │ │ │ │private-implementation detail │ │ │ │removed. This file should be │ │ │ │"published" (or exported, made │ │ │ │available) to users of the class. │ └────────────┴────────────┴────────────────────────────────────┘
Some of these files contain the public interface for the class; others contain the private interface. Some files are used to implement the class and its subclasses, and some are used by client programs that create and manipulate object instances of the class.
The IH and C files are the C-language source files for the class implementation. The IH file is included automatically in the C file. The IDL file is specified in the Include section of the class definition files for subclasses of the class. The H file must be included in client programs to create and manipulate object instances of the class. Separate public and private versions of the .H and .IDL files can be generated by the SOM tools.
A set of environment variables, as shown in the following table, control the SOM-compiler processing.
┌───────────────┬─────────────────────────────────────────────┐ │Variable │Description │ ├───────────────┼─────────────────────────────────────────────┤ │SMEMIT │Specifies which output files are to be │ │ │generated. │ ├───────────────┼─────────────────────────────────────────────┤ │SMINCLUDE │Specifies the location of the class │ │ │definition files (IDL). │ ├───────────────┼─────────────────────────────────────────────┤ │SMTMP │Specifies the directory to be used for │ │ │intermediate files. │ ├───────────────┼─────────────────────────────────────────────┤ │SOMIR │Specifies the names of interface repository │ │ │files. │ └───────────────┴─────────────────────────────────────────────┘
SMTMP is optional and defaults to the root directory of the current drive. If the files specified in the Include section of the class definition file are enclosed in double quotation marks, SMINCLUDE is optional and defaults to the root directory of the current drive. If the files specified in the Include section of the class definition file are enclosed in angled brackets ( < > ), SMINCLUDE is required for the SOM-compiler processing. SMEMIT is used to indicate which bindings files are generated.