Go backward to Overview of Adding Input and Output Routines.
Go up to Adding Input and Output Routines.
Go forward to Symbols.

Initialization
--------------

You must tell Soar about your input and output functions.  In Soar, this is
best done by writing a single initialization function and calling it within
the function system_startup_hook() in the file hooks.c.  This will require
altering hooks.c, so make sure the new version you make gets compiled into
Soar when you compile.


Alter hooks.c as follows:

extern void init_mysystems_io (void);   /* ADD A LINE LIKE THIS */

void system_startup_hook (void) {
  ...etc...

  init_mysystems_io();                  /* ADD A LINE LIKE THIS */

  ...etc...
}

The function add_input_function() tells Soar about your input function (a
function which will be called on each elaboration cycle).
Add_output_function() tells Soar about an output function to be called when a
specified output link appears on the top state.

Your initialization function, then, will look like this:

void init_mysystems_io (void) {

 /* --- tell the system about my I/O functions --- */
  add_input_function (my_input_function);
  add_output_function ("output-link", my_output_function);
}