How Import Requests Are Resolved
Whenever modules from different sources are combined into a single program, the compiler might have to process duplicate symbols.
Whenever
you enter a CRTPGM command, the ILE compiler resolves import requests
by:
- Copying listed modules into what will become the program object and links any service programs to the program object.
- Identifying the module containing the program entry procedure and locates the first import in this module.
- Checking the modules in the order in which they are listed and matches the first import with a module export.
- Returning to the first module and locates the next import.
- Resolving all imports in the first module.
- Continuing to the next module and resolving all imports in each subsequent module until all imports have been resolved.
After all the imports have been resolved, the ILE compiler completes
the binding process and creates the program object. If any imports
cannot be resolved with an export, the compiler terminates the binding
process without creating a program object.
Note: If you have specified
in the binder language that a variable is to be exported (using the EXPORT keyword),
it is possible that the variable name will be identical to a variable
in another procedure within the bound program object. You can use
the *DUPPROC option on the CRTPGM OPTION parameter
to allow duplicate procedure names. See the ILE C/C++ Compiler Reference for further information
on how to handle this situation.