C/C++ Code Generation Options

The following windows describe the options available for generating C or C++ source code.

The first tab, Code Modifications, contains options for adding C/C++-specific function types, adding type modifiers, and changing how files are output.

By default, ASN1C generates initialization functions that are used by generated code to ensure that newly-constructed types have appropriate default values. Memory free functions are not generated by default, but may be added when users need to free specific types individually instead of relying on ASN1C's built-in memory management functions. Bit macro functions may also be generated for setting, clearing, and testing bits in BIT STRING productions.

Table constraints in C/C++ were modified for ASN1C version 6.2 to make their data structures easier to manipulate. The table unions option causes a CHOICE-like union structure to be generated for information object classes. In practice, the generated code is more compact, easier to read, and confers several advantages for developers (principally type safety and readability).

The Generate static elements option is used to add static elements to CHOICE constructs instead of pointer values. Using fully-qualified enumerated types will cause ASN1C to emit enumerated types prefixed by their parent module name. Enumerated types are often reused in different modules, and ASN1C's automatic name resolution is usually insufficient to disambiguate which type is which. This option only needs to be selected in C, since C++ enumerations are contained in classes.

The other options are described in greater detail in Running ASN1C from the command-line.

The preceding window contains options for generating makefiles and Visual Studio projects. Makefile and project targets may be modified by selecting Generate Libraries or Link applications using shared libraries. If the latter option is checked, applications will be dynamically linked instead of statically linked.