RAD Module Linkage

Modules are registered with the RAD daemon in the _rad_reg function. Registration is automatically generated from the information contained within the IDL that defines the module.

Each module is required to provide a function, _rad_init, for initializing the module. This function is called before any other function in the module. Similarly, the _rad_fini function in the module is called by the RAD daemon just prior to unloading the module.

Example 4-3 Initializing and Registering a RAD Module

#include <rad/rad_modapi.h>

int
_rad_init(void)
{
	adr_name _t *uname = adr_name_vcreate("com.example.rad.user", 1, "type", "User");
    conerr_t cerr = rad_cont_insert_singleton(&rad_container, uname, &interface_User_svr);
    adr_name_rele(uname);

	if (cerr != CE_OK) 
	{
      	rad_log(RL_ERROR, "failed to insert module in container");
	  	return(-1);
    }
	return (0);
}