User manual
48
__declspec(dllexport)
void * __cdecl <COMPONENT-NAME>_INIT
(const chapi_in * ci, chapi_out * co, const char * instance_name);
where <COMPONENT-NAME> represents the name of the loadable component (see also
“Loadable component naming conventions” above). Note that the name of the initialization
routine must be converted to upper case. For example, the loadable module called dl11.dll
shall declare its initialization procedure as follows:
__declspec(dllexport)
void * __cdecl DL11_INIT
(const chapi_in * ci, chapi_out * co, const char * instance_name);
The moment when CHARON calls the component initialization routine shall be considered
by the loadable component as a request to confirm the creation of a new instance of the
device provided by the component.
The component initialization routine responds to the confirmation request with its return
value. CHARON considers any value other than zero as a confirmation, and a zero value
as a rejection. In case of confirmation, CHARON uses this value as an opaque identifier.
Later it passes this identifier as an additional parameter to certain procedures of the
CHAPI protocol.
2.4 Communication context binding
The CHAPI protocol defines a communication channel between the CHARON core and
the loadable component. Since the emulator can load multiple loadable components, and
each component can create several instances of devices, this can result in many
communication channels.
Each communication channel binds the CHARON core to one instance of a device
provided by a loadable component. This communication channel is described at each end
by the communication contexts. Each side of the communication is responsible for
creating and supporting its own contexts and setting up those contexts on behalf of the
other side. The CHAPI protocol defines a set of rules of this context setup and support,
which is called context binding.
CHARON creates its own communication context when processing the load command to
load its configuration. It creates a descriptor of the chapi_in communication context (the
chapi_in descriptor for short), fills it with zeros, and then fills certain fields with non-zero
values. It also creates a descriptor of the chapi_out communication context (the chapi_out
descriptor) and fills it with zeros. At that moment the CHARON core is ready to issue a
creation confirmation request by calling the component initialization routine.










