You are here: Part 2: Core Concepts > Data Types and DDS Data Samples > Creating User Data Types with IDL > Referring to Other IDL Files

Referring to Other IDL Files

IDL files may refer to other IDL files using a syntax borrowed from C, C+, and C+/CLI preprocessors:

#include "Bar.idl"

If RTI Code Generator encounters such a statement in an IDL file Foo.idl and runs with the preprocessor enabled (default), it will look in Bar.idl to resolve the types referenced in Foo.idl. For example:

Bar.idl
    struct Bar {
};

Foo.idl
    struct Foo {
    Bar m1;
};

The parsing of Foo in the previous scenario will be successful as Bar can be found in Bar.idl. If Bar was not declared in Bar.idl, RTI Code Generator will report an error indicating that the symbol could not be found.

If the preprocessor is not enabled when running RTI Code Generator (see command-line option -ppDisable), the parsing of the previous IDL file will fail because RTI Code Generator will not be able to find a reference to Bar within Bar.idl.

To prevent RTI Code Generator from resolving a type, use the //@resolve-name directive (see The @resolve-name Directive).

© 2016 RTI