Programming Guide


Installs application event functions

fnc_data_r *sm_install(int func_type, fnc_data_t funcs[], int *num_fncs);

Specifies the event function type. For event function types, refer to Table 44-1 in Application Development Guide.

The address of the fnc_data structure or array of structures to install. Functions to install with sm_install are stored in a fnc_data structure before installation. For more information about fnc_data structures, refer to "Preparing Functions for Installation" in Application Development Guide.

To deinstall functions, set funcs to 0. This removes all unprotected event functions of all func_type types.

Supply one of these arguments:


C only



sm_install is typically used when you build a Panther application or authoring executable. It compiles C functions and links them to Panther's function events. These C functions can be Panther library functions or functions that you write. sm_install can also install and deinstall functions at runtime.

The file funclist.c, provided in source form with Panther, can be used as a template for installing automatic and demand event functions. This file contains sample fnc_data structure definitions and corresponding calls to sm_install. Most of these calls are used to install dummy functions to the local function lists. Replace these with your own installations.

Note that in funclist.c, calls to sm_install are made by sm_do_uinstalls. sm_do_uinstalls is called after sm_initcrt, which calls the initialization event functions. Consequently, you should not install an initialization event function with funclist.c.

For specific examples of event function installation, refer to Chapter 44, "Installed Event Functions," in Application Development Guide.


/* Include the functions in fnc_data structures */

/* Install two prototyped functions that return ints,
dereference JPL-supplied variables, and take two int
arguments. */
fnc_data_t proto_list[] = {
SM_INTFNC("mark_fields(i,i)", mark_flds),
SM_INTFNC("report(s,s)", report)

/* Install a screen function that returns an int, does
not perform dereferencing on JPL-supplied variables,
and takes two string arguments. */
fnc_data_t autosc_struct = SM_OLDFNC(0, auto_sfunc);

/* Install the functions */
int ct = sizeof(proto_list) / sizeof(fnc_data_t);
sm_install(PROTO_FUNC, proto_list, &ct);
sm_install(DFLT_SCREEN_FUNC, &autosc_struct, (int *)0);