Configuration Files and Cross-Compiling

Applies to: ASN.1/C++ v7.3-7.3.1

The OSS ASN.1/C++ Compiler has default settings for all global directives, as described in the ASN.1/C++ Compiler Directives Reference. A custom compiler configuration file can be created with different default settings, if desired. A configuration file is necessary only if you prefer to use a different set of default values or when cross-compiling is required (see below). In the latter case, OSS provides the configuration file.

Cross-Compiling to a Different Platform

By default, the ASN.1/C++ Compiler generates files for use on the operating system where the compiler executable runs. However, the compiler can be instructed to produce files for use on a different operating system by passing the asn1dflt file for the target system as the first input file on the command-line.

OSS Nokalva provides asn1dflt configuration files to use when cross-compiling. asn1dflt configuration files contain only comments and directives; these directives are used instead of those the ASN.1/C++ Compiler uses by default. The directives in the asn1dflt file remain in effect for the entire run of the compiler.

For example, the ASN.1/C++ Compiler for Windows generates files with an 8-byte alignment (/Zp8) by default. This same compiler can also create files usable on 64-bit Solaris 7 with the proper asn1dflt file. The following command will compile the abc.asn file on Windows for use with the 64-bit Solaris 7 operating system:

asn1cpp asn1dflt.cpp.solaris7-64bit abc.asn

asn1dflt.cpp.solaris7-64bit is the name of the asn1dflt file for the 64-bit Solaris 7 platform and is included in the ASN.1/C++ Tools for 64-bit Solaris 7 target software. Every OSS ASN.1 Tools target software distribution contains an asn1dflt file for that specific target platform.

After cross-compiling, copy the generated output files to the target platform machine where the application is being developed. Incorporate the generated files into the application in the usual way.

As noted above, the ASN.1/C++ Compiler for Windows generates files with an 8-byte alignment (/Zp8). The OSS ASN.1 Tools for Windows also includes asn1dflt files with different data-alignment options:

Filename Data Alignment
asn1dflt.ms.zp1 1-byte (/Zp1)
asn1dflt.ms.zp2 2-byte (/Zp2)
asn1dflt.ms.zp4 4-byte (/Zp4)
asn1dflt.ms.zp8 8-byte (/Zp8)

Examples

These examples further demonstrate using asn1dflt in cross-compiling:

  • This command compiles the abc.asn file for use with Windows and MS Visual C++ with a default 8-byte alignment (/Zp8):
    prompt%> asn1cpp asn1dflt.ms.zp8 abc.asn
    This is the default for the OSS ASN.1 Tools for C++ on Windows.
  • This command compiles the abc.asn file for use with Windows and MS Visual C++ with a 1-byte alignment (/Zp1):
    prompt%> asn1cpp asn1dflt.ms.zp1 abc.asn
  • This command compiles the abc.asn file for use with the Linux operating system:
    prompt%> asn1cpp  asn1dflt.linux-x86 abc.asn

After cross-compilation, copy the generated output files to the target machine. Then integrate the generated files into your application.

See Also


This documentation applies to release 7.3 and later of the OSS® ASN.1 Tools for C++.

Copyright © 2024 OSS Nokalva, Inc. All rights reserved.
No part of this publication may be reproduced, stored in a retrieval system, or transmitted in any form or by any means electronic, mechanical, photocopying, recording or otherwise, without the prior permission of OSS Nokalva, Inc.
Every distributed copy of the OSS® ASN.1 Tools for C++ is associated with a specific license and related unique license number. That license determines, among other things, what functions of the OSS ASN.1 Tools for C++ are available to you.