In A.1.10

    package_item ::=
        package_or_generate_item_declaration
        | anonymous_program
        | package_export_declaration
        | timeunits_declaration

In Syntax 19.1

    package_item ::=
        package_or_generate_item_declaration
        | anonymous_program
        | package_export_declaration
        | timeunits_declaration

In A.2.1.3 Type declarations

    package_export_declaration ::=
        export *::*;
        | export package_import_item { , package_import_item } ;



In 19.2

19.2.2.3  Exporting imported names from packages

 

package_export_declaration ::=
        export *::*;
        | export package_import_item { , package_import_item } ;


 
 


   

Syntax 19-3—Package export syntax (excerpt from Annex A)


By default, declarations imported into a package are not visible by way of subsequent imports of that package.  Package export declarations allow a package to specify that imported declarations  are to be made visible in subsequent imports.


Wildcard Package Exports

An export of the form package_name::* exports all declarations that were actually imported from "package_name" within the context of the exporting package.  All names from "package_name", whether imported directly or through wildcard imports, are made available. Symbols that are candidates for import but not actually imported are not made available.  The special wildcard export form,  “export *::*;”  exports all imported declarations from all packages from which imports occur.

Direct Package Exports

An export of the form package_name::name makes the given declaration available. It shall be an error if the given declaration is not a candidate for import or if the declaration is not actually imported in the package.  If the declaration is an unreferenced candidate for import, the export shall be considered to be a reference and shall import the declaration into the package following the same rules as for a direct import of the name.

Imports of exported declarations

An import of a declaration made visible through an export is equivalent to an import of the original declaration.  Thus direct or wildcard import of a declaration by way of multiple exported paths does not cause conflicts.

Multiple exports of the same declaration

It is valid to specify multiple exports that export the same actual declaration.


Examples:

 

package p1;

   int x,y;

endpackage

 

 

package p2;

   import p1::x;

   export p1::*;    // exports p1::x as the name "x";

                    // p1::x and p2::x are the same declaration

endpackage

 

package p3;
   import p1::*;
   export p2::*;

   int q = x;

   // p1::x and q are made available from p2.  Although p1::y

   // is a candidate for import, it is not actually imported

   // since it is not referenced. Since p1::y is not imported,

   // it is not made available by the export.
endpackage

 


package p4;

   import p1::*;

   export p1::*;

   int y = x;       // y is available as a direct declaration;

                    // p1::x is made available by the export

endpackage

 

package p5;

   import p4::*;

   export p1::x;    // p1::x is visible since it is exported

                    // from p4.

   export p4::x;    // p4::x refers to the same declaration

                    // as p1::x so this is legal.

                       

endpackage

 

package p6;

    import p1::*;

    export p1::x;

    int x;          // Error. export p1::x is considered to                      

                    // be a reference to "x" so a subsequent

                    // declaration of x is illegal.

endpackage

 

package p7;

    int y;

endpackage;

 

package p8;

    import p7::y;

    import p1::x;

    export *::*;    // Exports both p7::y and p1::x.

endpackage

 

module top;

   import p2::*;

   import p4::*;

   int y = x;       // x is p1::x

endmodule