Using the SOM Compiler to Build an Interface Repository

The SOMobjects Toolkit includes an Interface Repository emitter that is invoked whenever the SOM Compiler is run using an sc command with the -u option (which "updates" the interface repository). The IR emitter can be used to create or update an Interface Repository file. The IR emitter expects that an environment variable, SOMIR, was first set to designate a file name for the Interface Repository. For example, to compile an IDL source file named "newcls.idl" and create an Interface Repository named "newcls.ir", use a command sequence similar to the following:

For OS/2:

set SOMIR=c:\myfiles\newcls.ir
sc -u newcls

For AIX:

export SOMIR=~/newcls.ir
sc -u newcls

If the SOMIR environment variable is not set, the Interface Repository emitter creates a file named "som.ir" in the current directory.

The sc or somc command runs the Interface Reposito emitter plus any other emitters indicated by the environment variable SMEMIT (described in the topic "Running the SOM Compiler" in Chapter 4, "Implementing SOM Classes"). To run the Interface Repository emitter by itself, issue the sc command with the -s option (which overrides SMEMIT) set to "ir". For example:

sc -u -sir newcls        (ON OS/2 or AIX)
somc -u -sir newcls      (On Windows)
or equivalently,
sc -usir newcls          (On OS/2 or AIX)
somc -usir newcls        (On Windows)

The Interface Repository emitter uses the SOMIR environment variable to locate the designated IR file. If the file does not exist, the IR emitter creates it. If the named interface repository already exists, the IR emitter checks all of the "type" information in the IDL source file being compiled for internal consistency, and then changes the contents of the interface repository file to agree with with the new IDL definition. For this reason, the use of the -u compiler flag requires that all of the types mentioned in the IDL source file must be fully defined within the scope of the compilation. Warning messages from the SOM Compiler about undefined types result in actual error messages when using the -u flag.

The additional type checking and file updating activity implied by the -u flag increases the time it takes to run the SOM Compiler. Thus, when developing an IDL class description from scratch, where iterative changes are to be expected, it may be preferable not to use the -u compiler option until the class definition has stabilized.


[Back: Introduction]
[Next: Managing Interface Repository files]