External types and values can be readily formed in ATS to refer to types
and values declared in C.
Suppose that there is a type in C of the name some_type_in_c,
then this type can be referred to in ATS as
$extype"some_type_in_c". For instance, type definitions are
introduced in the following code for some external types in C:
Suppose that there is a value in C of the name
some_value_in_c,
then this value can be referred to in ATS as
$extval(T, "some_value_in_c"),
where T is a type in ATS assigned to this value. For instance, macro
definitions are introduced in the following code for some external values
in C:
External values can also be formed to refer to functions in C as done
in the following code:
Note that there are other ways in ATS that are often more approriate for
directly referring to functions in C. Typically, the primary purpose of
forming an external value in ATS is to allow a constant declared in C to be
directly referred to in ATS code.