Transact C client library


sp_clinit


Initialise the client library: should only be called once by a client application as part of its own initialization function.

ANSI Prototype

_kernel_oserror *sp_clinit(void);

Possible errors

What does sp_clinit do?

  1. It registers an exit function which purpose is to free ressources allocated since sp_clinit was called and close the still open sessions with the engine.
  2. It performs specific initialisations, eg for the RISC OS module interface it determines the Transact SWI numbers from the name of the SWIs (using the "OS_SWINumberFromString" SWI);
  3. It initializes the data structure to store the opened sessions' ids;

Sample code

#include <stdlib.h>
#define __CLIENT__
#include "transact.h"

static void app_init(void)
{
/* initialsise as a toolbox task */
_kernel_oserror *e= toolbox_initialise(0,310, messages, tbcodes,
	"<MyApp$Dir>", &mbl, &idblk, 0,0,0);
if(!e)	e= sp_clinit();
if(e)	{
	wimp_report_error(e, 0,0,0,0);
	exit(EXIT_FAILURE);
	}

/* Initialise event lib */
event_initialise(&idblk);
...
}