Sign in

docs ILE Concepts

Duplicate Symbols

Duplicate Symbols

The symbols for variable names and procedure names can be exported from modules as either weak exports or strong exports.

Weak exports are supported by various programming languages as described in section Import and Export Concepts. When a module defines and references a weak symbol, the symbol is both weakly exported and imported. Several modules can define the same symbol as a weak export. During symbol resolution, the export from one module is chosen to satisfy all the matching imports so all modules refer to the same item.

Strong exports are generally defined by a single module. If more than one module defines the symbol as a strong export, an error message is issued and program creation will fail. On the program creation commands (CRTPGM, CRTSRVPGM, UPDPGM, UPDSRVPGM), you can use OPTION(*DUPPROC *DUPVAR *WARN) to allow the command to continue despite the duplicate symbol export warning messages. These error messages are important: when a module refers to a symbol that it exports, the reference is made as a local reference, not as an import reference. If two modules define the same symbol as a strong export, and each module refers to the symbol, they are referring to separate items. Carefully examine these messages to ensure your application will function correctly. You may need to change the strong exports to weak exports or change the code so that only a single module exports the symbol and all other modules import it.