TOC PREV NEXT INDEX


IMPORT/EXPORT of Types



ASN1C allows productions to be shared between different modules through the ASN.1 IMPORT/EXPORT mechanism. The compiler parses but ignores the EXPORTS declaration within a module. As far as it is concerned, any type defined within a module is available for import by another module.

When ASN1C sees an IMPORT statement, it first checks its list of loaded modules to see if the module has already been loaded into memory. If not, it will attempt to find and parse another source file containing the module. The logic for locating the source file is as follows:


In both cases, the -I command line option can be used to tell the compiler where to look for the files.

The other way of specifying multiple modules is to include them all within a single ASN.1 source file. It is possible to have an ASN.1 source file containing multiple module definitions in which modules IMPORT definitions from other modules. An example of this would be the following:

	ModuleA DEFINITIONS ::= BEGIN
 
	   IMPORTS B From ModuleB;
 

 
	   A ::= B
 

 
	
 
       END
 

 
	ModuleB DEFINITIONS ::= BEGIN
 

 
	   B ::= INTEGER
 

 
	END
 

 
This entire fragment of code would be present in a single ASN.1 source file.


Objective Systems, Inc.

102 Pickering Way, Suite #506
Exton, Pennsylvania 19341
http://www.obj-sys.com
Phone: (484) 875-9841
Toll-free: (877) 307-6855 (US only)
Fax: (484) 875-9830
info@obj-sys.com
TOC PREV NEXT INDEX