Importing from C (DFDL): restrictions
Problems or restrictions when you import a C header file to create a message model.
- The C construct
typedef
is not fully supported; you cannot create messages based on atypedef
of an anonymous structure. - If an empty
struct
orunion
is used as the basis for creating a message, two messages with the same name are created. - The C importer does not handle the
#if
,#ifdef
,#else
,#elif
macros properly. Before importing a C structure, remove these macros from the source file. - Hexadecimal constants such as int
a[0x80]
can cause an exception to be thrown during the import operation. Replace them in the header file before importing. - Trigraphs are not supported. Replace trigraphs with the equivalent single character before importing the header file.
- The C importer requires all programs to be syntactically correct on the target platform. Results are unpredictable if this is not the case. In some circumstances the IBM® Integration Toolkit might crash.
- When C type int is imported with the option Address size=64bit,
elements of schema type
xsd:int
are created. These have an implicit range of a 32-bit integer. Change the schema type of the element toxsd:long
to use values with 64-bit range. - Importing C source where an anonymous structure contains an embedded
structure might result in an exception. Before you import the header
file, ensure that all structures have tags, for example:
struct mymessage_tag { int a; struct { // anonymous structure... int b1; struct myembstruct_tag { // ...containing a structure int c1; } c; } b; };
- An exception might be thrown when an
enum
with a negative value is imported. Remove the negative value before importing the header file. - Structure and element names entirely in uppercase or starting with an underscore might be altered on import.
- Importing
char
arrays with 3 or more dimensions, when using the option to import strings as null terminated, can result in an incorrectmaxLength
facet. - Importing char arrays with 3 or more dimensions can cause a Java™ exception to be thrown. Ensure the definitions created are correct.
- The use of C or C++ reserved keywords causes the import to fail,
but nothing in the report specifically indicates this. If your import
fails without an obvious reason, examine the C header file carefully
and ensure that it compiles correctly. Even if it does compile correctly,
it might still contain C++ keywords such as
compl
, which cause the importer to fail.
- Bit fields within a C structure are imported. The type is created
as
xs:hexBinary
. Change the type in the DFDL editor to match the C type. Review the values of the DFDL Length, Length Units, Leading Skip, Trailing Skip, Alignment and Alignment Units properties, which might not be set properly. - Octal constants such as int
a[080]
are incorrectly interpreted as decimal constants and must be corrected using the DFDL editor.