
7 The MLWorks Foreign Interface Library
7.10 The C structure
This structure contains the language-specific part of the interface providing support for C. It has the following sub-structures:
structure Structure
structure Type
structure Value
structure Signature
structure Function
structure Diagnostic
The basic idea behind this part of the FI is to provide support for a C-compatible data model within ML. Foreign data representation is provided under this model via the object type.
Objects may be considered to have two main components: a value part and a type part. The value part of an object consists of the raw information concerning what is being denoted, whereas the type part specifies how the value part can be interpreted. Both components of objects are under the control of the ML programmer and can be manipulated in ways that are familiar to a C programmer. Furthermore, the value parts of objects are associated with physical storage via a given store workspace, thereby ensuring that memory allocation is (i) static and (ii) decoupled from the representation of specific data values.
This structure also provides an interface for robustly managing dynamically linked foreign code and invoking it. This is provided via the C.Structure and C.Signature sub-structures. The basic idea here is that linked-in foreign code provides raw behavior, which is kept locked within a c_structure object. To access and use this raw behavior, another object called a c_signature is needed to provide signature information as c_type values. When appropriately matching c_signature and c_structure objects are combined, this permits the raw behavior contained within the c_structure to be invoked.
- 7.10.1 - The C.Structure structure
-
- c_structure
-
- load_mode
-
- loadObjectFile
-
- fileInfo
-
- filesLoaded
-
- symbols
-
- value_type
-
- symbolInfo
-
- 7.10.2 - The C.Type structure
-
- enum_value
-
- tag
-
- pointer_kind
-
- c_type
-
- c_variant
-
- c_field
-
- sizeOf
-
- equalType
-
- structType
-
- unionType
-
- ptrType
-
- typeName
-
- enumType
-
- 7.10.3 - The C.Value structure
-
- store
-
- object_mode
-
- c_type
-
- c_object
-
- object
-
- setObjectMode
-
- objectType
-
- castObjectType
-
- tmpObject
-
- dupObject
-
- newObject
-
- c_char
-
- c_short_int
-
- c_int
-
- c_long_int
-
- c_real
-
- c_double
-
- c_long_status
-
- ForeignType
-
- StoreAccess
-
- OutOfBounds
-
- Currency
-
- setChar
-
- setUnsignedChar
-
- setSignedChar
-
- setShort
-
- setInt
-
- setLong
-
- setUnsignedShort
-
- setUnsigned
-
- setUnsignedLong
-
- setWord32
-
- setFloat
-
- setDouble
-
- setLongDouble
-
- setString
-
- setAddr
-
- setPtrAddr
-
- setPtrAddrOf
-
- setPtrData
-
- setPtrType
-
- castPtrType
-
- setLocalPtr
-
- setRelativePtr
-
- setRemotePtr
-
- setStruct
-
- setField
-
- setMember
-
- setUnion
-
- setArray
-
- setEnum
-
- indexObject
-
- derefObject
-
- selectObject
-
- coerceObject
-
- copyIndexObject
-
- copyDerefObject
-
- copySelectObject
-
- copyCoerceObject
-
- indexObjectType
-
- derefObjectType
-
- selectObjectType
-
- coerceObjectType
-
- indexObjectSize
-
- derefObjectSize
-
- selectObjectSize
-
- coerceObjectSize
-
- nextArrayItem
-
- prevArrayItem
-
- getChar
-
- getUnsignedChar
-
- getSignedChar
-
- getShort
-
- getInt
-
- getLong
-
- getUnsignedShort
-
- getUnsigned
-
- getUnsignedLong
-
- getWord32
-
- getFloat
-
- getDouble
-
- getLongDouble
-
- getString
-
- getData
-
- getStruct
-
- getField
-
- getUnion
-
- getArray
-
- getEnum
-
- 7.10.4 - The C.Signature structure
-
- c_type
-
- c_signature
-
- c_decl
-
- newSignature
-
- lookupEntry
-
- defEntry
-
- removeEntry
-
- showEntries
-
- normaliseType
-
- 7.10.5 - The C.Function structure
-
- c_structure
-
- c_signature
-
- c_type
-
- c_object
-
- c_function
-
- defineForeignFun
-
- call
-
- 7.10.6 - The C.Diagnostic structure
-
- store
-
- c_type
-
- c_object
-
- cTypeInfo
-
- viewObject
-
- dispObject
-
- objectInfo
-
- objectData
-
- objectDataHex
-
- objectDataAscii
-
MLWorks Reference Manual (version 1.0) - 3 DEC 1996

Generated with Harlequin WebMaker