extern "C" used in skeletons

diff --git a/ChangeLog b/ChangeLog
index 927f6ae..ab91083 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,8 +1,11 @@
 
-0.9.17:	2005-July-20
+0.9.17:	2005-July-24
 
 	* Tagging mode is implicitly IMPLICIT if AUTOMATIC TAGS is used, #30.6.
 	  (Test cases 55, 86).
+	* Started to use extern "C" {} in skeleton headers.
+	* Introduced -finline-choice command line option to fix
+	  yet another class of circular references.
 
 0.9.16:	2005-July-04
 
diff --git a/skeletons/ANY.h b/skeletons/ANY.h
index cabc411..c9b17db 100644
--- a/skeletons/ANY.h
+++ b/skeletons/ANY.h
@@ -7,6 +7,10 @@
 
 #include <OCTET_STRING.h>	/* Implemented via OCTET STRING type */
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 typedef struct ANY {
 	uint8_t *buf;	/* BER-encoded ANY contents */
 	int size;	/* Size of the above buffer */
@@ -36,4 +40,8 @@
 #define	ANY_fromBuf(s, buf, size)	OCTET_STRING_fromBuf((s), (buf), (size))
 #define	ANY_new_fromBuf(buf, size)	OCTET_STRING_new_fromBuf((buf), (size))
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif	/* ASN_TYPE_ANY_H */
diff --git a/skeletons/BIT_STRING.h b/skeletons/BIT_STRING.h
index 1601231..732e878 100644
--- a/skeletons/BIT_STRING.h
+++ b/skeletons/BIT_STRING.h
@@ -7,6 +7,10 @@
 
 #include <OCTET_STRING.h>	/* Some help from OCTET STRING */
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 typedef struct BIT_STRING_s {
 	uint8_t *buf;	/* BIT STRING body */
 	int size;	/* Size of the above buffer */
@@ -22,4 +26,8 @@
 asn_constr_check_f BIT_STRING_constraint;
 xer_type_encoder_f BIT_STRING_encode_xer;
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif	/* _BIT_STRING_H_ */
diff --git a/skeletons/BMPString.h b/skeletons/BMPString.h
index cd51597..a4725fa 100644
--- a/skeletons/BMPString.h
+++ b/skeletons/BMPString.h
@@ -7,6 +7,10 @@
 
 #include <OCTET_STRING.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 typedef OCTET_STRING_t BMPString_t;  /* Implemented via OCTET STRING */
 
 extern asn_TYPE_descriptor_t asn_DEF_BMPString;
@@ -15,4 +19,8 @@
 xer_type_decoder_f BMPString_decode_xer;
 xer_type_encoder_f BMPString_encode_xer;
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif	/* _BMPString_H_ */
diff --git a/skeletons/BOOLEAN.h b/skeletons/BOOLEAN.h
index fd173d1..ec4dbac 100644
--- a/skeletons/BOOLEAN.h
+++ b/skeletons/BOOLEAN.h
@@ -7,6 +7,10 @@
 
 #include <asn_application.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /*
  * The underlying integer may contain various values, but everything
  * non-zero is capped to 0xff by the DER encoder. The BER decoder may
@@ -23,4 +27,8 @@
 xer_type_decoder_f BOOLEAN_decode_xer;
 xer_type_encoder_f BOOLEAN_encode_xer;
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif	/* _BOOLEAN_H_ */
diff --git a/skeletons/ENUMERATED.h b/skeletons/ENUMERATED.h
index 45733cb..53cc273 100644
--- a/skeletons/ENUMERATED.h
+++ b/skeletons/ENUMERATED.h
@@ -7,8 +7,16 @@
 
 #include <INTEGER.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 typedef INTEGER_t ENUMERATED_t;		/* Implemented via INTEGER */
 
 extern asn_TYPE_descriptor_t asn_DEF_ENUMERATED;
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif	/* _ENUMERATED_H_ */
diff --git a/skeletons/GeneralString.h b/skeletons/GeneralString.h
index d284674..70ef1ab 100644
--- a/skeletons/GeneralString.h
+++ b/skeletons/GeneralString.h
@@ -7,8 +7,16 @@
 
 #include <OCTET_STRING.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 typedef OCTET_STRING_t GeneralString_t;	/* Implemented via OCTET STRING */
 
 extern asn_TYPE_descriptor_t asn_DEF_GeneralString;
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif	/* _GeneralString_H_ */
diff --git a/skeletons/GeneralizedTime.h b/skeletons/GeneralizedTime.h
index 6b4c1ec..1ea06b0 100644
--- a/skeletons/GeneralizedTime.h
+++ b/skeletons/GeneralizedTime.h
@@ -7,6 +7,10 @@
 
 #include <OCTET_STRING.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 typedef OCTET_STRING_t GeneralizedTime_t;  /* Implemented via OCTET STRING */
 
 extern asn_TYPE_descriptor_t asn_DEF_GeneralizedTime;
@@ -58,4 +62,8 @@
 GeneralizedTime_t *asn_time2GT_frac(GeneralizedTime_t *_optional_gt,
 	const struct tm *, int frac_value, int frac_digits, int force_gmt);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif	/* _GeneralizedTime_H_ */
diff --git a/skeletons/GraphicString.h b/skeletons/GraphicString.h
index ac78f3e..7bc9492 100644
--- a/skeletons/GraphicString.h
+++ b/skeletons/GraphicString.h
@@ -7,8 +7,16 @@
 
 #include <OCTET_STRING.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 typedef OCTET_STRING_t GraphicString_t;	/* Implemented via OCTET STRING */
 
 extern asn_TYPE_descriptor_t asn_DEF_GraphicString;
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif	/* _GraphicString_H_ */
diff --git a/skeletons/IA5String.h b/skeletons/IA5String.h
index c20bc6b..e2a909d 100644
--- a/skeletons/IA5String.h
+++ b/skeletons/IA5String.h
@@ -7,6 +7,10 @@
 
 #include <OCTET_STRING.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 typedef OCTET_STRING_t IA5String_t;  /* Implemented via OCTET STRING */
 
 /*
@@ -16,4 +20,8 @@
 
 asn_constr_check_f IA5String_constraint;
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif	/* _IA5String_H_ */
diff --git a/skeletons/INTEGER.h b/skeletons/INTEGER.h
index 416efd9..165c055 100644
--- a/skeletons/INTEGER.h
+++ b/skeletons/INTEGER.h
@@ -8,6 +8,10 @@
 #include <asn_application.h>
 #include <asn_codecs_prim.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 typedef ASN__PRIMITIVE_TYPE_t INTEGER_t;
 
 extern asn_TYPE_descriptor_t asn_DEF_INTEGER;
@@ -52,4 +56,8 @@
  */
 const asn_INTEGER_enum_map_t *INTEGER_map_value2enum(asn_INTEGER_specifics_t *specs, long value);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif	/* _INTEGER_H_ */
diff --git a/skeletons/ISO646String.h b/skeletons/ISO646String.h
index 5c3c73a..b42dd0d 100644
--- a/skeletons/ISO646String.h
+++ b/skeletons/ISO646String.h
@@ -8,8 +8,16 @@
 #include <asn_application.h>
 #include <VisibleString.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 typedef VisibleString_t ISO646String_t;	/* Implemented using VisibleString */
 
 extern asn_TYPE_descriptor_t asn_DEF_ISO646String;
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif	/* _ISO646String_H_ */
diff --git a/skeletons/NULL.h b/skeletons/NULL.h
index bce436b..28a3630 100644
--- a/skeletons/NULL.h
+++ b/skeletons/NULL.h
@@ -7,6 +7,10 @@
 
 #include <asn_application.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /*
  * The value of the NULL type is meaningless: see BOOLEAN if you want to
  * carry true/false semantics.
@@ -20,4 +24,8 @@
 xer_type_decoder_f NULL_decode_xer;
 xer_type_encoder_f NULL_encode_xer;
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif	/* NULL_H */
diff --git a/skeletons/NativeEnumerated.h b/skeletons/NativeEnumerated.h
index 16f1bfd..7e2bb1b 100644
--- a/skeletons/NativeEnumerated.h
+++ b/skeletons/NativeEnumerated.h
@@ -14,8 +14,16 @@
 
 #include <NativeInteger.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 extern asn_TYPE_descriptor_t asn_DEF_NativeEnumerated;
 
 xer_type_encoder_f NativeEnumerated_encode_xer;
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif	/* _NativeEnumerated_H_ */
diff --git a/skeletons/NativeInteger.h b/skeletons/NativeInteger.h
index b66d29a..f38fd47 100644
--- a/skeletons/NativeInteger.h
+++ b/skeletons/NativeInteger.h
@@ -15,6 +15,10 @@
 #include <asn_application.h>
 #include <INTEGER.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 extern asn_TYPE_descriptor_t asn_DEF_NativeInteger;
 
 asn_struct_free_f  NativeInteger_free;
@@ -24,4 +28,8 @@
 xer_type_decoder_f NativeInteger_decode_xer;
 xer_type_encoder_f NativeInteger_encode_xer;
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif	/* _NativeInteger_H_ */
diff --git a/skeletons/NativeReal.h b/skeletons/NativeReal.h
index 32dd7f6..1f5266c 100644
--- a/skeletons/NativeReal.h
+++ b/skeletons/NativeReal.h
@@ -13,6 +13,10 @@
 
 #include <asn_application.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 extern asn_TYPE_descriptor_t asn_DEF_NativeReal;
 
 asn_struct_free_f  NativeReal_free;
@@ -22,4 +26,8 @@
 xer_type_decoder_f NativeReal_decode_xer;
 xer_type_encoder_f NativeReal_encode_xer;
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif	/* ASN_TYPE_NativeReal_H */
diff --git a/skeletons/NumericString.h b/skeletons/NumericString.h
index 5ace1dd..51e24e8 100644
--- a/skeletons/NumericString.h
+++ b/skeletons/NumericString.h
@@ -7,10 +7,18 @@
 
 #include <OCTET_STRING.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 typedef OCTET_STRING_t NumericString_t;	/* Implemented via OCTET STRING */
 
 extern asn_TYPE_descriptor_t asn_DEF_NumericString;
 
 asn_constr_check_f NumericString_constraint;
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif	/* _NumericString_H_ */
diff --git a/skeletons/OBJECT_IDENTIFIER.h b/skeletons/OBJECT_IDENTIFIER.h
index c1c9e2c..56a1f76 100644
--- a/skeletons/OBJECT_IDENTIFIER.h
+++ b/skeletons/OBJECT_IDENTIFIER.h
@@ -9,6 +9,10 @@
 #include <asn_application.h>
 #include <asn_codecs_prim.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 typedef ASN__PRIMITIVE_TYPE_t OBJECT_IDENTIFIER_t;
 
 extern asn_TYPE_descriptor_t asn_DEF_OBJECT_IDENTIFIER;
@@ -128,4 +132,8 @@
 int OBJECT_IDENTIFIER_set_single_arc(uint8_t *arcbuf,
 	void *arcval, unsigned int arcval_size, int _prepared_order);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif	/* _OBJECT_IDENTIFIER_H_ */
diff --git a/skeletons/OCTET_STRING.h b/skeletons/OCTET_STRING.h
index a4d5e41..94c19a0 100644
--- a/skeletons/OCTET_STRING.h
+++ b/skeletons/OCTET_STRING.h
@@ -7,6 +7,10 @@
 
 #include <asn_application.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 typedef struct OCTET_STRING {
 	uint8_t *buf;	/* Buffer with consecutive OCTET_STRING bits */
 	int size;	/* Size of the buffer */
@@ -67,4 +71,8 @@
 	int subvariant;		/* {0,1,2} for O-S, BIT STRING or ANY */
 } asn_OCTET_STRING_specifics_t;
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif	/* _OCTET_STRING_H_ */
diff --git a/skeletons/ObjectDescriptor.h b/skeletons/ObjectDescriptor.h
index 54a0000..fa1753e 100644
--- a/skeletons/ObjectDescriptor.h
+++ b/skeletons/ObjectDescriptor.h
@@ -7,8 +7,16 @@
 
 #include <GraphicString.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 typedef GraphicString_t ObjectDescriptor_t;  /* Implemented via GraphicString */
 
 extern asn_TYPE_descriptor_t asn_DEF_ObjectDescriptor;
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif	/* _ObjectDescriptor_H_ */
diff --git a/skeletons/PrintableString.h b/skeletons/PrintableString.h
index e4a230d..2ece440 100644
--- a/skeletons/PrintableString.h
+++ b/skeletons/PrintableString.h
@@ -7,10 +7,18 @@
 
 #include <OCTET_STRING.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 typedef OCTET_STRING_t PrintableString_t;  /* Implemented via OCTET STRING */
 
 extern asn_TYPE_descriptor_t asn_DEF_PrintableString;
 
 asn_constr_check_f PrintableString_constraint;
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif	/* _PrintableString_H_ */
diff --git a/skeletons/REAL.h b/skeletons/REAL.h
index 114b7e5..28ccf28 100644
--- a/skeletons/REAL.h
+++ b/skeletons/REAL.h
@@ -8,6 +8,10 @@
 #include <asn_application.h>
 #include <asn_codecs_prim.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 typedef ASN__PRIMITIVE_TYPE_t REAL_t;
 
 extern asn_TYPE_descriptor_t asn_DEF_REAL;
@@ -31,4 +35,8 @@
 int asn_REAL2double(const REAL_t *real_ptr, double *d);
 int asn_double2REAL(REAL_t *real_ptr, double d);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif	/* ASN_TYPE_REAL_H */
diff --git a/skeletons/RELATIVE-OID.h b/skeletons/RELATIVE-OID.h
index 2b7f13d..2235cfd 100644
--- a/skeletons/RELATIVE-OID.h
+++ b/skeletons/RELATIVE-OID.h
@@ -7,6 +7,10 @@
 
 #include <OBJECT_IDENTIFIER.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* Implemented via OBJECT IDENTIFIER */
 typedef OBJECT_IDENTIFIER_t RELATIVE_OID_t;
 
@@ -28,4 +32,8 @@
 int RELATIVE_OID_set_arcs(RELATIVE_OID_t *_roid,
 	void *arcs, unsigned int arc_type_size, unsigned int arcs_slots);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif	/* _RELATIVE_OID_H_ */
diff --git a/skeletons/T61String.h b/skeletons/T61String.h
index 46b12ce..f706338 100644
--- a/skeletons/T61String.h
+++ b/skeletons/T61String.h
@@ -7,8 +7,16 @@
 
 #include <OCTET_STRING.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 typedef OCTET_STRING_t T61String_t;	/* Implemented via OCTET STRING */
 
 extern asn_TYPE_descriptor_t asn_DEF_T61String;
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif	/* _T61String_H_ */
diff --git a/skeletons/TeletexString.h b/skeletons/TeletexString.h
index a408d58..ffd0f52 100644
--- a/skeletons/TeletexString.h
+++ b/skeletons/TeletexString.h
@@ -7,8 +7,16 @@
 
 #include <OCTET_STRING.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 typedef OCTET_STRING_t TeletexString_t;	/* Implemented via OCTET STRING */
 
 extern asn_TYPE_descriptor_t asn_DEF_TeletexString;
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif	/* _TeletexString_H_ */
diff --git a/skeletons/UTCTime.h b/skeletons/UTCTime.h
index 6d26807..8035b34 100644
--- a/skeletons/UTCTime.h
+++ b/skeletons/UTCTime.h
@@ -7,6 +7,10 @@
 
 #include <OCTET_STRING.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 typedef OCTET_STRING_t UTCTime_t;  /* Implemented via OCTET STRING */
 
 extern asn_TYPE_descriptor_t asn_DEF_UTCTime;
@@ -27,4 +31,8 @@
 /* See asn_time2GT() in GeneralizedTime.h */
 UTCTime_t *asn_time2UT(UTCTime_t *__opt_ut, const struct tm *, int force_gmt);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif	/* _UTCTime_H_ */
diff --git a/skeletons/UTF8String.h b/skeletons/UTF8String.h
index 84e6eaf..3bc8ea6 100644
--- a/skeletons/UTF8String.h
+++ b/skeletons/UTF8String.h
@@ -7,6 +7,10 @@
 
 #include <OCTET_STRING.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 typedef OCTET_STRING_t UTF8String_t;	/* Implemented via OCTET STRING */
 
 extern asn_TYPE_descriptor_t asn_DEF_UTF8String;
@@ -38,4 +42,8 @@
  */
 size_t UTF8String_to_wcs(const UTF8String_t *st, uint32_t *dst, size_t dstlen);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif	/* _UTF8String_H_ */
diff --git a/skeletons/UniversalString.h b/skeletons/UniversalString.h
index 3be8cab..1476a6f 100644
--- a/skeletons/UniversalString.h
+++ b/skeletons/UniversalString.h
@@ -7,6 +7,10 @@
 
 #include <OCTET_STRING.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 typedef OCTET_STRING_t UniversalString_t;  /* Implemented via OCTET STRING */
 
 extern asn_TYPE_descriptor_t asn_DEF_UniversalString;
@@ -15,4 +19,8 @@
 xer_type_decoder_f UniversalString_decode_xer;
 xer_type_encoder_f UniversalString_encode_xer;
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif	/* _UniversalString_H_ */
diff --git a/skeletons/VideotexString.h b/skeletons/VideotexString.h
index 0a156e2..3b551c3 100644
--- a/skeletons/VideotexString.h
+++ b/skeletons/VideotexString.h
@@ -7,8 +7,16 @@
 
 #include <OCTET_STRING.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 typedef OCTET_STRING_t VideotexString_t;  /* Implemented via OCTET STRING */
 
 extern asn_TYPE_descriptor_t asn_DEF_VideotexString;
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif	/* _VideotexString_H_ */
diff --git a/skeletons/VisibleString.h b/skeletons/VisibleString.h
index ca05bea..20ba8cc 100644
--- a/skeletons/VisibleString.h
+++ b/skeletons/VisibleString.h
@@ -7,10 +7,18 @@
 
 #include <OCTET_STRING.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 typedef OCTET_STRING_t VisibleString_t;  /* Implemented via OCTET STRING */
 
 extern asn_TYPE_descriptor_t asn_DEF_VisibleString;
 
 asn_constr_check_f VisibleString_constraint;
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif	/* _VisibleString_H_ */
diff --git a/skeletons/asn_SEQUENCE_OF.h b/skeletons/asn_SEQUENCE_OF.h
index 1109f23..e678f03 100644
--- a/skeletons/asn_SEQUENCE_OF.h
+++ b/skeletons/asn_SEQUENCE_OF.h
@@ -7,6 +7,10 @@
 
 #include <asn_SET_OF.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /*
  * SEQUENCE OF is the same as SET OF with a tiny difference:
  * the delete operation preserves the initial order of elements
@@ -41,4 +45,8 @@
 #define _A_SEQUENCE_FROM_VOID(ptr)	((asn_anonymous_sequence_ *)(ptr))
 #define _A_CSEQUENCE_FROM_VOID(ptr) 	((const asn_anonymous_sequence_ *)(ptr))
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif	/* ASN_SEQUENCE_OF_H */
diff --git a/skeletons/asn_SET_OF.h b/skeletons/asn_SET_OF.h
index 774549f..7edf14b 100644
--- a/skeletons/asn_SET_OF.h
+++ b/skeletons/asn_SET_OF.h
@@ -5,6 +5,10 @@
 #ifndef	ASN_SET_OF_H
 #define	ASN_SET_OF_H
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #define	A_SET_OF(type)					\
 	struct {					\
 		type **array;				\
@@ -51,4 +55,8 @@
 #define _A_SET_FROM_VOID(ptr)		((asn_anonymous_set_ *)(ptr))
 #define _A_CSET_FROM_VOID(ptr)		((const asn_anonymous_set_ *)(ptr))
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif	/* ASN_SET_OF_H */
diff --git a/skeletons/asn_application.h b/skeletons/asn_application.h
index 4987e5c..d639341 100644
--- a/skeletons/asn_application.h
+++ b/skeletons/asn_application.h
@@ -11,6 +11,10 @@
 #include <asn_system.h>		/* for platform-dependent types */
 #include <asn_codecs.h>		/* for ASN.1 codecs specifics */
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /*
  * Generic type of an application-defined callback to return various
  * types of data to the application.
@@ -23,4 +27,8 @@
 
 #include <constr_TYPE.h>	/* for asn_TYPE_descriptor_t */
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif	/* _ASN_APPLICATION_H_ */
diff --git a/skeletons/asn_codecs.h b/skeletons/asn_codecs.h
index b08ce65..9250ada 100644
--- a/skeletons/asn_codecs.h
+++ b/skeletons/asn_codecs.h
@@ -5,6 +5,10 @@
 #ifndef	_ASN_CODECS_H_
 #define	_ASN_CODECS_H_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 struct asn_TYPE_descriptor_s;	/* Forward declaration */
 
 /*
@@ -51,7 +55,10 @@
 	void *structure_ptr;
 } asn_enc_rval_t;
 #define	_ASN_ENCODE_FAILED do {					\
-	asn_enc_rval_t tmp_error = { -1, td, sptr };		\
+	asn_enc_rval_t tmp_error;				\
+	tmp_error.encoded = -1;					\
+	tmp_error.failed_type = td;				\
+	tmp_error.structure_ptr = sptr;				\
 	return tmp_error;					\
 } while(0)
 
@@ -73,4 +80,8 @@
 	size_t consumed;		/* Number of bytes consumed */
 } asn_dec_rval_t;
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif	/* _ASN_CODECS_H_ */
diff --git a/skeletons/asn_codecs_prim.h b/skeletons/asn_codecs_prim.h
index 67658f4..0f683fd 100644
--- a/skeletons/asn_codecs_prim.h
+++ b/skeletons/asn_codecs_prim.h
@@ -7,6 +7,10 @@
 
 #include <asn_application.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 typedef struct ASN__PRIMITIVE_TYPE_s {
 	uint8_t *buf;	/* Buffer with consecutive primitive encoding bytes */
 	int size;	/* Size of the buffer */
@@ -42,4 +46,8 @@
 	xer_primitive_body_decoder_f *prim_body_decoder
 );
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif	/* ASN_CODECS_PRIM_H */
diff --git a/skeletons/ber_decoder.h b/skeletons/ber_decoder.h
index af8d8e3..fc25984 100644
--- a/skeletons/ber_decoder.h
+++ b/skeletons/ber_decoder.h
@@ -7,6 +7,10 @@
 
 #include <asn_application.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 struct asn_TYPE_descriptor_s;	/* Forward declaration */
 struct asn_codec_ctx_s;		/* Forward declaration */
 
@@ -52,4 +56,8 @@
 		int *opt_tlv_form	/* optional tag form */
 	);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif	/* _BER_DECODER_H_ */
diff --git a/skeletons/ber_tlv_length.h b/skeletons/ber_tlv_length.h
index b7d6f74..d912706 100644
--- a/skeletons/ber_tlv_length.h
+++ b/skeletons/ber_tlv_length.h
@@ -5,6 +5,10 @@
 #ifndef	_BER_TLV_LENGTH_H_
 #define	_BER_TLV_LENGTH_H_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 typedef ssize_t ber_tlv_len_t;
 
 /*
@@ -40,4 +44,8 @@
  */
 size_t der_tlv_length_serialize(ber_tlv_len_t len, void *bufptr, size_t size);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif	/* _BER_TLV_LENGTH_H_ */
diff --git a/skeletons/ber_tlv_tag.h b/skeletons/ber_tlv_tag.h
index 51c9a08..60e8668 100644
--- a/skeletons/ber_tlv_tag.h
+++ b/skeletons/ber_tlv_tag.h
@@ -5,6 +5,10 @@
 #ifndef	_BER_TLV_TAG_H_
 #define	_BER_TLV_TAG_H_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 enum asn_tag_class {
 	ASN_TAG_CLASS_UNIVERSAL		= 0,	/* 0b00 */
 	ASN_TAG_CLASS_APPLICATION	= 1,	/* 0b01 */
@@ -49,4 +53,8 @@
  */
 size_t ber_tlv_tag_serialize(ber_tlv_tag_t tag, void *bufptr, size_t size);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif	/* _BER_TLV_TAG_H_ */
diff --git a/skeletons/constr_CHOICE.h b/skeletons/constr_CHOICE.h
index ea32467..859c532 100644
--- a/skeletons/constr_CHOICE.h
+++ b/skeletons/constr_CHOICE.h
@@ -7,6 +7,10 @@
 
 #include <asn_application.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 typedef struct asn_CHOICE_specifics_s {
 	/*
 	 * Target structure description.
@@ -40,4 +44,8 @@
 xer_type_encoder_f CHOICE_encode_xer;
 asn_outmost_tag_f CHOICE_outmost_tag;
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif	/* _CONSTR_CHOICE_H_ */
diff --git a/skeletons/constr_SEQUENCE.h b/skeletons/constr_SEQUENCE.h
index e7bb4fe..ab8a8ec 100644
--- a/skeletons/constr_SEQUENCE.h
+++ b/skeletons/constr_SEQUENCE.h
@@ -7,6 +7,10 @@
 
 #include <asn_application.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 typedef struct asn_SEQUENCE_specifics_s {
 	/*
 	 * Target structure description.
@@ -39,4 +43,8 @@
 xer_type_decoder_f SEQUENCE_decode_xer;
 xer_type_encoder_f SEQUENCE_encode_xer;
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif	/* _CONSTR_SEQUENCE_H_ */
diff --git a/skeletons/constr_SEQUENCE_OF.h b/skeletons/constr_SEQUENCE_OF.h
index 684ec26..94b04cd 100644
--- a/skeletons/constr_SEQUENCE_OF.h
+++ b/skeletons/constr_SEQUENCE_OF.h
@@ -8,6 +8,10 @@
 #include <asn_application.h>
 #include <constr_SET_OF.h>		/* Implemented using SET OF */
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /*
  * A set specialized functions dealing with the SEQUENCE OF type.
  * Generally implemented using SET OF.
@@ -20,4 +24,8 @@
 der_type_encoder_f SEQUENCE_OF_encode_der;
 xer_type_encoder_f SEQUENCE_OF_encode_xer;
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif	/* _CONSTR_SET_OF_H_ */
diff --git a/skeletons/constr_SET.h b/skeletons/constr_SET.h
index 7e8af97..3adfb33 100644
--- a/skeletons/constr_SET.h
+++ b/skeletons/constr_SET.h
@@ -7,6 +7,10 @@
 
 #include <asn_application.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 
 typedef struct asn_SET_specifics_s {
 	/*
@@ -71,4 +75,8 @@
 		|= (1 << ((8 * sizeof(unsigned int)) - 1		\
 		- ((PR_x) % (8 * sizeof(unsigned int))))))
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif	/* _CONSTR_SET_H_ */
diff --git a/skeletons/constr_SET_OF.h b/skeletons/constr_SET_OF.h
index 8d2fb50..410be26 100644
--- a/skeletons/constr_SET_OF.h
+++ b/skeletons/constr_SET_OF.h
@@ -7,6 +7,10 @@
 
 #include <asn_application.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 typedef struct asn_SET_OF_specifics_s {
 	/*
 	 * Target structure description.
@@ -29,4 +33,8 @@
 xer_type_decoder_f SET_OF_decode_xer;
 xer_type_encoder_f SET_OF_encode_xer;
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif	/* _CONSTR_SET_OF_H_ */
diff --git a/skeletons/constr_TYPE.h b/skeletons/constr_TYPE.h
index e36f293..90b6578 100644
--- a/skeletons/constr_TYPE.h
+++ b/skeletons/constr_TYPE.h
@@ -14,6 +14,10 @@
 #include <ber_tlv_length.h>
 #include <ber_tlv_tag.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 struct asn_TYPE_descriptor_s;	/* Forward declaration */
 struct asn_TYPE_member_s;	/* Forward declaration */
 
@@ -157,4 +161,8 @@
 	asn_TYPE_descriptor_t *td,	/* ASN.1 type descriptor */
 	const void *struct_ptr);	/* Structure to be printed */
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif	/* _CONSTR_TYPE_H_ */
diff --git a/skeletons/constraints.h b/skeletons/constraints.h
index d8434e4..51fad8e 100644
--- a/skeletons/constraints.h
+++ b/skeletons/constraints.h
@@ -7,6 +7,10 @@
 
 #include <asn_system.h>		/* Platform-dependent types */
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 struct asn_TYPE_descriptor_s;		/* Forward declaration */
 
 /*
@@ -51,4 +55,8 @@
 void _asn_i_log_error(asn_app_consume_bytes_f *, void *key,
 	const char *fmt, ...) __attribute__ ((format(printf, 3, 4)));
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif	/* _ASN1_CONSTRAINTS_VALIDATOR_H_ */
diff --git a/skeletons/der_encoder.h b/skeletons/der_encoder.h
index cb784d1..9e7867d 100644
--- a/skeletons/der_encoder.h
+++ b/skeletons/der_encoder.h
@@ -7,6 +7,10 @@
 
 #include <asn_application.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 struct asn_TYPE_descriptor_s;	/* Forward declaration */
 
 /*
@@ -56,4 +60,8 @@
 		void *app_key
 	);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif	/* _DER_ENCODER_H_ */
diff --git a/skeletons/xer_decoder.h b/skeletons/xer_decoder.h
index e372bbd..349f349 100644
--- a/skeletons/xer_decoder.h
+++ b/skeletons/xer_decoder.h
@@ -7,6 +7,10 @@
 
 #include <asn_application.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 struct asn_TYPE_descriptor_s;	/* Forward declaration */
 
 /*
@@ -95,4 +99,8 @@
  */
 int xer_skip_unknown(xer_check_tag_e tcv, ber_tlv_len_t *depth);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif	/* _XER_DECODER_H_ */
diff --git a/skeletons/xer_encoder.h b/skeletons/xer_encoder.h
index 5f9bbf2..96d87b8 100644
--- a/skeletons/xer_encoder.h
+++ b/skeletons/xer_encoder.h
@@ -7,6 +7,10 @@
 
 #include <asn_application.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 struct asn_TYPE_descriptor_s;	/* Forward declaration */
 
 /* Flags used by the xer_encode() and (*xer_type_encoder_f), defined below */
@@ -48,4 +52,8 @@
 		void *app_key		/* Arbitrary callback argument */
 	);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif	/* _XER_ENCODER_H_ */
diff --git a/skeletons/xer_support.h b/skeletons/xer_support.h
index e25678c..8b01944 100644
--- a/skeletons/xer_support.h
+++ b/skeletons/xer_support.h
@@ -8,6 +8,10 @@
 
 #include <asn_system.h>		/* Platform-specific types */
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /*
  * Types of data transferred to the application.
  */
@@ -44,4 +48,8 @@
 ssize_t pxml_parse(int *_stateContext, const void *_buf, size_t _size,
 	pxml_callback_f *cb, void *_key);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif	/* _XER_SUPPORT_H_ */