Compiling and Linking Generated Code
C/C++ source code generated by the compiler can be compiled using any ANSI standard C or C++ compiler. The only additional option that must be set is the inclusion of the ASN.1 C/C++ header file include directory with the -I option.
When linking a program with compiler-generated code, it is necessary to include the ASN.1 run-time libraries. It is necessary to include at least one of the encoding rules libraries (asn1ber, asn1per, or asn1xer) as well as the common run-time functions library (asn1rt). See the ASN1C C/C++ Run-time Reference Manual for further details on these libraries.
For static linking on Windows systems, the name of the library files are asn1ber_a.lib, asn1per_a.lib, or asn1xer_a.lib for BER/DER, PER, or XER respectively, and asn1rt_a.lib for the common run-time components. On UNIX/Linux, the library names are libasn1ber.a, libasn1per.a, libasn1xer.a, and libasn1rt.a. The library files are located in the lib subdirectory. For UNIX, the -L switch should be used to point to the subdirectory path and -lasn1ber, -lasn1per, -lasn1xer, and/or -lasn1rt used to link with the libraries. For Windows, the -LIBPATH switch should be used to specify the library path.
There are several other variations of the C/C++ run-time library files for Windows. The following table summarizes what options were used to build each of these variations:
For dynamic linking on UNIX/Linux, a shared object version of each run-time library is included in the lib subdirectory. This file typically has the extension .so (for shared object) or .sl (for shared library). See the documentation for your UNIX compiler to determine how to link using these files (it varies for different types of UNIX systems).
Compiling and linking code generated to support the XML encoding rules (XER) is more complex then the other rules because XER requires the use of third-party XML parser software. This requires the use of additional include directories when compiling and libraries when linking. The C++ sample programs that are provided use the EXPAT XML parser (http://www.expat.org/). All of the necessary include files and binary libraries are included with the distribution for using this parser. If a different parser is to be used, consult the vendor's documentation for compile and link procedures.
Objective Systems, Inc.102 Pickering Way, Suite #506Exton, 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 |