Import

An import statement identifies a set of parts that are in a specified package (for EGL source files) or in a specified set of files (for EGL build files). The file that holds an import statement can reference the imported parts as if they were in the same package as the file.

Background

If a public part resides in a package other than the current one but is not identified in an import statement, your code needs to qualify the part name (for example, myPart) with the package name (for example, my.pkg), as in this example:

  my.pkg.myPart

If the part is identified in an import statement, however, your code can drop the package name. In this case, the unqualified part name (like myPart) is sufficient.

For a description of the circumstances in which import statements are used to resolve a part name, see References to Parts.

Format of the import statement

The syntax is as follows for the import statement in an EGL file:

  import packageName.partSelection;

packageName

Identifies the name of a package in which to search. The name must be complete.

partSelection

Is a part name or an asterisk (*). The asterisk indicates that all parts in the package are selected.

An import statement in a build file identifies other build files whose parts can be referenced by parts in the importing file. The import statements follow the <EGL> tag in the build file, and each statement has the following syntax:

  <import file=filePath.eglbld>

filePath

Identifies the path and name of the file to import. If you specify a path, the following statements apply:

  • The file path is in any of the source directories in the same project or in any other project that is in the EGL path

  • Each qualifier is separated from the next by a virgule (/)

You may specify an asterisk (*) as the file name or as the last chararacter of the file name. If the asterisk is used, EGL imports all the .eglbld files with these characteristics:

  • Are in the specified file path.

  • Have names that begin with the characters that precede the asterisk. (If the asterisk has no preceding characters, all build files in the directory path are selected.)

The file extension .eglbld is optional.

Related concepts
EGL projects, packages, and files
Introduction to EGL
Parts
References to parts

Related tasks
Editing an EGL build path