Next: , Previous: , Up: Top   [Contents][Index]


3 Core type definitions

CCStructs offers an API to handle struct values. The library cannot reference the concrete types of struct the client libraries will use, so it just defines a placeholder for them.

Struct Typedef: ccstructs_core_t

Type of struct values used as argument to CCStructs functions. This is just a forward type declaration: there is no actual declaration of this type.

When using this type we need to explicitly cast a pointer to client struct values to a pointer to ccstruct_core_t. For example, when defining a constructor for the dumpable trait:

ccstructs_dumpable_T
ccname_trait_new(ccstructs_dumpable_T, spiffy_t) (spiffy_t * S)
{
  return ccname_new(ccstructs_dumpable_T)(ccstructs_core(S),
    &ccname_trait_table(ccstructs_dumpable_T, spiffy_t));
}
Function: ccstructs_core_t const * ccstructs_core (void const * S)

Cast the pointer S to ccstructs_core_t *.

Function Prototype: void ccstructs_core_destructor_fun_t (ccstructs_core_t * self)

Type of functions implementing the destructor for struct instances. Functions of this type must always return to their caller, never raising an exception.


Next: , Previous: , Up: Top   [Contents][Index]

This document describes version 0.3.0-devel.3 of CCStructs.